@atlaskit/calendar 12.4.5 → 13.0.1

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/calendar.js +24 -42
  3. package/dist/cjs/internal/components/date.js +19 -17
  4. package/dist/cjs/internal/components/{heading.js → header.js} +21 -45
  5. package/dist/cjs/internal/components/week-day-grid.js +34 -0
  6. package/dist/cjs/internal/components/week-days.js +7 -14
  7. package/dist/cjs/internal/components/week-header.js +28 -23
  8. package/dist/cjs/internal/styles/date.js +2 -2
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/calendar.js +22 -42
  11. package/dist/es2019/internal/components/date.js +19 -17
  12. package/dist/es2019/internal/components/header.js +60 -0
  13. package/dist/es2019/internal/components/week-day-grid.js +23 -0
  14. package/dist/es2019/internal/components/week-days.js +7 -15
  15. package/dist/es2019/internal/components/week-header.js +23 -23
  16. package/dist/es2019/internal/styles/date.js +2 -2
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/calendar.js +23 -42
  19. package/dist/esm/internal/components/date.js +19 -17
  20. package/dist/esm/internal/components/header.js +61 -0
  21. package/dist/esm/internal/components/week-day-grid.js +25 -0
  22. package/dist/esm/internal/components/week-days.js +7 -15
  23. package/dist/esm/internal/components/week-header.js +24 -24
  24. package/dist/esm/internal/styles/date.js +2 -2
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/calendar.d.ts +1 -1
  27. package/dist/types/internal/components/{heading.d.ts → header.d.ts} +3 -3
  28. package/dist/types/internal/components/week-day-grid.d.ts +15 -0
  29. package/package.json +11 -4
  30. package/report.api.md +1 -1
  31. package/dist/es2019/internal/components/heading.js +0 -82
  32. package/dist/esm/internal/components/heading.js +0 -88
package/CHANGELOG.md CHANGED
@@ -1,5 +1,31 @@
1
1
  # @atlaskit/calendar
2
2
 
3
+ ## 13.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b0f6dd0bc35`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b0f6dd0bc35) - Updated to use typography tokens. There is no expected behaviour or visual change.
8
+
9
+ ## 13.0.0
10
+
11
+ ### Major Changes
12
+
13
+ - [`642298a54dc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/642298a54dc) - Major changes:
14
+
15
+ - Removing support for legacy dark mode.
16
+
17
+ Minor changes:
18
+
19
+ - Removal of row containers in day of month grid.
20
+ - Vertically center heading inside the calendar.
21
+ - Minor changes to visual layout to conform to design system tokens.
22
+ - Composition change of DOM elements in day of week header.
23
+ - Remove hardcoded `width: 289px`. Calendar now fills natural width of content.
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 12.4.5
4
30
 
5
31
  ### Patch Changes
@@ -19,15 +19,17 @@ var _react2 = require("@emotion/react");
19
19
 
20
20
  var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
21
21
 
22
- var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
22
+ var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
23
+
24
+ var _stack = _interopRequireDefault(require("@atlaskit/ds-explorations/stack"));
23
25
 
24
- var _colors = require("@atlaskit/theme/colors");
26
+ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
25
27
 
26
28
  var _components = _interopRequireDefault(require("@atlaskit/theme/components"));
27
29
 
28
30
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
29
31
 
30
- var _heading = _interopRequireDefault(require("./internal/components/heading"));
32
+ var _header = _interopRequireDefault(require("./internal/components/header"));
31
33
 
32
34
  var _weekDays = _interopRequireDefault(require("./internal/components/week-days"));
33
35
 
@@ -55,38 +57,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
55
57
 
56
58
  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
59
 
58
- var lightWrapperStyles = (0, _react2.css)({
59
- display: 'inline-block',
60
- boxSizing: 'border-box',
61
- // TODO Delete this comment after verifying spacing token -> previous value `16`
62
- padding: "var(--ds-scale-200, 16px)",
63
- backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.N0, ")"),
64
- color: "var(--ds-text, ".concat(_colors.N900, ")"),
65
- outline: 'none',
66
- userSelect: 'none'
67
- });
68
- var darkWrapperStyles = (0, _react2.css)({
69
- display: 'inline-block',
70
- boxSizing: 'border-box',
71
- // TODO Delete this comment after verifying spacing token -> previous value `16`
72
- padding: "var(--ds-scale-200, 16px)",
73
- backgroundColor: "var(--ds-UNSAFE_util-transparent, ".concat(_colors.N700, ")"),
74
- color: "var(--ds-text, ".concat(_colors.DN600, ")"),
75
- outline: 'none',
76
- userSelect: 'none'
77
- });
78
- var gridsContainerStyles = (0, _react2.css)({
79
- display: 'inline-block',
80
- width: 289,
81
- // TODO Delete this comment after verifying spacing token -> previous value `0`
82
- margin: "var(--ds-scale-0, 0px)",
83
- marginBottom: 5,
84
- textAlign: 'center'
85
- });
86
60
  var analyticsAttributes = {
87
61
  componentName: 'calendar',
88
62
  packageName: "@atlaskit/calendar",
89
- packageVersion: "12.4.5"
63
+ packageVersion: "13.0.1"
90
64
  };
91
65
  var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_ref, ref) {
92
66
  var day = _ref.day,
@@ -126,7 +100,8 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
126
100
  weekStartDay = _ref$weekStartDay === void 0 ? 0 : _ref$weekStartDay,
127
101
  testId = _ref.testId,
128
102
  calendarRef = _ref.calendarRef,
129
- mode = _ref.mode,
103
+ _ref$mode = _ref.mode,
104
+ mode = _ref$mode === void 0 ? 'light' : _ref$mode,
130
105
  className = _ref.className,
131
106
  style = _ref.style,
132
107
  _ref$tabIndex = _ref.tabIndex,
@@ -232,26 +207,33 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
232
207
  monthsLong = _useLocale.monthsLong,
233
208
  daysShort = _useLocale.daysShort;
234
209
 
235
- return (0, _react2.jsx)("div", {
210
+ return (0, _react2.jsx)(_box.default, {
236
211
  className: className,
237
- style: style,
212
+ UNSAFE_style: style,
213
+ backgroundColor: "elevation.surface",
238
214
  onBlur: handleContainerBlur,
239
215
  onFocus: handleContainerFocus,
240
216
  onKeyDown: handleContainerKeyDown,
241
217
  role: "presentation",
242
- "data-testid": testId && "".concat(testId, "--container"),
218
+ testId: testId && "".concat(testId, "--container"),
243
219
  ref: ref
244
220
  }, (0, _react2.jsx)(_visuallyHidden.default, null, (0, _react2.jsx)("span", {
245
221
  id: announceId,
246
222
  "aria-live": "assertive",
247
223
  "aria-relevant": "text"
248
- }, announcerDate)), (0, _react2.jsx)("div", {
249
- css: !mode || mode === 'light' ? lightWrapperStyles : darkWrapperStyles,
224
+ }, announcerDate)), (0, _react2.jsx)(_box.default, {
225
+ display: "inlineBlock",
226
+ padding: "scale.200",
227
+ UNSAFE_style: {
228
+ userSelect: 'none'
229
+ },
250
230
  "aria-describedby": announceId,
251
231
  "aria-label": "calendar",
252
232
  role: "grid",
253
233
  tabIndex: tabIndex
254
- }, (0, _react2.jsx)(_heading.default // The month number needs to be translated to index in the month
234
+ }, (0, _react2.jsx)(_stack.default, {
235
+ gap: "scale.150"
236
+ }, (0, _react2.jsx)(_header.default // The month number needs to be translated to index in the month
255
237
  // name array e.g. 1 (January) -> 0
256
238
  , {
257
239
  monthLongTitle: monthsLong[monthValue - 1],
@@ -262,8 +244,8 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
262
244
  handleClickPrev: handleClickPrev,
263
245
  mode: mode,
264
246
  testId: testId
265
- }), (0, _react2.jsx)("div", {
266
- css: gridsContainerStyles,
247
+ }), (0, _react2.jsx)(_box.default, {
248
+ display: "block",
267
249
  role: "presentation"
268
250
  }, (0, _react2.jsx)(_weekHeader.default, {
269
251
  daysShort: daysShort,
@@ -273,7 +255,7 @@ var CalendarWithMode = /*#__PURE__*/(0, _react.forwardRef)(function Calendar(_re
273
255
  handleClickDay: handleClickDay,
274
256
  mode: mode,
275
257
  testId: testId
276
- }))));
258
+ })))));
277
259
  });
278
260
  /**
279
261
  * __Calendar__
@@ -68,23 +68,25 @@ var Date = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
68
68
  var dateCellStyles = (0, _react.useMemo)(function () {
69
69
  return (0, _react2.css)((0, _date.dateCellStyles)(mode));
70
70
  }, [mode]);
71
- return (0, _react2.jsx)("button", {
72
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
73
- css: dateCellStyles,
74
- "aria-selected": isSelected ? 'true' : 'false',
75
- tabIndex: isSelected ? 0 : -1,
76
- type: "button",
77
- role: "gridcell",
78
- onClick: handleClick,
79
- ref: ref,
80
- "data-disabled": isDisabled || undefined,
81
- "data-focused": isFocused || undefined,
82
- "data-prev-selected": isPreviouslySelected || undefined,
83
- "data-selected": isSelected || undefined,
84
- "data-sibling": isSibling || undefined,
85
- "data-today": isToday || undefined,
86
- "data-testid": testId && isSelected ? "".concat(testId, "--selected-day") : undefined
87
- }, day);
71
+ return (// eslint-disable-next-line @repo/internal/react/use-primitives
72
+ (0, _react2.jsx)("button", {
73
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
74
+ css: dateCellStyles,
75
+ "aria-selected": isSelected ? 'true' : 'false',
76
+ tabIndex: isSelected ? 0 : -1,
77
+ type: "button",
78
+ role: "gridcell",
79
+ onClick: handleClick,
80
+ ref: ref,
81
+ "data-disabled": isDisabled || undefined,
82
+ "data-focused": isFocused || undefined,
83
+ "data-prev-selected": isPreviouslySelected || undefined,
84
+ "data-selected": isSelected || undefined,
85
+ "data-sibling": isSibling || undefined,
86
+ "data-today": isToday || undefined,
87
+ "data-testid": testId && isSelected ? "".concat(testId, "--selected-day") : undefined
88
+ }, day)
89
+ );
88
90
  }));
89
91
  Date.displayName = 'Date'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
90
92
 
@@ -13,6 +13,12 @@ var _react2 = require("@emotion/react");
13
13
 
14
14
  var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
15
15
 
16
+ var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
17
+
18
+ var _inline = _interopRequireDefault(require("@atlaskit/ds-explorations/inline"));
19
+
20
+ var _heading = _interopRequireDefault(require("@atlaskit/heading"));
21
+
16
22
  var _chevronLeftLarge = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-left-large"));
17
23
 
18
24
  var _chevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-right-large"));
@@ -20,36 +26,7 @@ var _chevronRightLarge = _interopRequireDefault(require("@atlaskit/icon/glyph/ch
20
26
  var _colors = require("@atlaskit/theme/colors");
21
27
 
22
28
  /** @jsx jsx */
23
- var headingColor = {
24
- light: "var(--ds-text, ".concat(_colors.N800, ")"),
25
- dark: "var(--ds-text, ".concat(_colors.DN800, ")")
26
- };
27
- var headingStyles = (0, _react2.css)({
28
- display: 'flex',
29
- // TODO Delete this comment after verifying spacing tokens
30
- padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-0, 0px)", " 13px ", "var(--ds-scale-0, 0px)"),
31
- color: "var(--ds-text, ".concat(_colors.N800, ")"),
32
- fontWeight: 'bold'
33
- });
34
-
35
- var getMonthAndYearStyles = function getMonthAndYearStyles() {
36
- var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
37
- return (0, _react2.css)({
38
- flexBasis: '100%',
39
- color: headingColor[mode],
40
- textAlign: 'center'
41
- });
42
- };
43
-
44
- var arrowLeftStyles = (0, _react2.css)({
45
- // TODO Delete this comment after verifying spacing token -> previous value `8`
46
- marginLeft: "var(--ds-scale-100, 8px)"
47
- });
48
- var arrowRightStyles = (0, _react2.css)({
49
- // TODO Delete this comment after verifying spacing token -> previous value `8`
50
- marginRight: "var(--ds-scale-100, 8px)"
51
- });
52
- var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
29
+ var Header = /*#__PURE__*/(0, _react.memo)(function Header(_ref) {
53
30
  var monthLongTitle = _ref.monthLongTitle,
54
31
  year = _ref.year,
55
32
  _ref$previousMonthLab = _ref.previousMonthLabel,
@@ -58,16 +35,16 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
58
35
  nextMonthLabel = _ref$nextMonthLabel === void 0 ? 'Next month' : _ref$nextMonthLabel,
59
36
  handleClickPrev = _ref.handleClickPrev,
60
37
  handleClickNext = _ref.handleClickNext,
61
- mode = _ref.mode,
62
38
  testId = _ref.testId;
63
- var monthAndYearStyles = (0, _react.useMemo)(function () {
64
- return getMonthAndYearStyles(mode);
65
- }, [mode]);
66
- return (0, _react2.jsx)("div", {
67
- css: headingStyles,
39
+ return (0, _react2.jsx)(_box.default, {
40
+ display: "block",
41
+ paddingInline: "scale.100",
68
42
  "aria-hidden": "true"
43
+ }, (0, _react2.jsx)(_inline.default, {
44
+ gap: "scale.0",
45
+ alignItems: "center",
46
+ justifyContent: "space-between"
69
47
  }, (0, _react2.jsx)(_standardButton.default, {
70
- css: arrowLeftStyles,
71
48
  appearance: "subtle",
72
49
  spacing: "none",
73
50
  tabIndex: -1,
@@ -79,12 +56,11 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
79
56
  primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
80
57
  testId: testId && "".concat(testId, "--previous-month-icon")
81
58
  })
82
- }), (0, _react2.jsx)("div", {
83
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
84
- css: monthAndYearStyles,
85
- "data-testid": testId && "".concat(testId, "--current-month-year")
59
+ }), (0, _react2.jsx)(_heading.default, {
60
+ level: "h400",
61
+ as: "div",
62
+ testId: testId && "".concat(testId, "--current-month-year")
86
63
  }, "".concat(monthLongTitle, " ").concat(year)), (0, _react2.jsx)(_standardButton.default, {
87
- css: arrowRightStyles,
88
64
  appearance: "subtle",
89
65
  spacing: "none",
90
66
  tabIndex: -1,
@@ -96,9 +72,9 @@ var Heading = /*#__PURE__*/(0, _react.memo)(function Heading(_ref) {
96
72
  primaryColor: "var(--ds-text-subtlest, ".concat(_colors.N70, ")"),
97
73
  testId: testId && "".concat(testId, "--next-month-icon")
98
74
  })
99
- }));
75
+ })));
100
76
  });
101
- Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
77
+ Header.displayName = 'Header'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
102
78
 
103
- var _default = Heading;
79
+ var _default = Header;
104
80
  exports.default = _default;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("@emotion/react");
9
+
10
+ /** @jsx jsx */
11
+ var gridStyles = (0, _react.css)({
12
+ display: 'grid',
13
+ gridTemplateColumns: 'repeat(7, minmax(max-content, 1fr))'
14
+ });
15
+
16
+ /**
17
+ * __Week day grid__
18
+ *
19
+ * A week day grid aligns elements in a 7 wide grid layout.
20
+ *
21
+ */
22
+ var WeekDayGrid = function WeekDayGrid(_ref) {
23
+ var testId = _ref.testId,
24
+ children = _ref.children;
25
+ return (// eslint-disable-next-line @repo/internal/react/use-primitives
26
+ (0, _react.jsx)("div", {
27
+ "data-testid": testId,
28
+ css: gridStyles
29
+ }, children)
30
+ );
31
+ };
32
+
33
+ var _default = WeekDayGrid;
34
+ exports.default = _default;
@@ -13,28 +13,21 @@ var _react2 = require("@emotion/react");
13
13
 
14
14
  var _date = _interopRequireDefault(require("./date"));
15
15
 
16
+ var _weekDayGrid = _interopRequireDefault(require("./week-day-grid"));
17
+
16
18
  /** @jsx jsx */
17
- var daysGridStyles = (0, _react2.css)({
18
- display: 'grid',
19
- gridTemplateColumns: 'repeat(7, 1fr)',
20
- border: 0
21
- });
22
19
  var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
23
20
  var weeks = _ref.weeks,
24
21
  handleClickDay = _ref.handleClickDay,
25
22
  mode = _ref.mode,
26
23
  testId = _ref.testId;
27
- return (0, _react2.jsx)("div", {
24
+ return (0, _react2.jsx)(_weekDayGrid.default, {
28
25
  role: "grid",
29
- "data-testid": testId && "".concat(testId, "--month")
26
+ testId: testId && "".concat(testId, "--month")
30
27
  }, weeks.map(function (week) {
31
- return (0, _react2.jsx)("div", {
32
- role: "row",
33
- key: week.id,
34
- css: daysGridStyles
35
- }, week.values.map(function (weekDay) {
28
+ return week.values.map(function (weekDay) {
36
29
  return (0, _react2.jsx)(_date.default, {
37
- key: weekDay.id,
30
+ key: "".concat(week.id, "-").concat(weekDay.id),
38
31
  isDisabled: weekDay.isDisabled,
39
32
  isFocused: weekDay.isFocused,
40
33
  isToday: weekDay.isToday,
@@ -47,7 +40,7 @@ var WeekDays = /*#__PURE__*/(0, _react.memo)(function WeekDays(_ref) {
47
40
  mode: mode,
48
41
  testId: testId
49
42
  }, weekDay.day);
50
- }));
43
+ });
51
44
  }));
52
45
  });
53
46
  WeekDays.displayName = 'WeekDays'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -9,35 +11,38 @@ var _react = require("react");
9
11
 
10
12
  var _react2 = require("@emotion/react");
11
13
 
14
+ var _box = _interopRequireDefault(require("@atlaskit/ds-explorations/box"));
15
+
16
+ var _text = _interopRequireDefault(require("@atlaskit/ds-explorations/text"));
17
+
12
18
  var _colors = require("@atlaskit/theme/colors");
13
19
 
20
+ var _weekDayGrid = _interopRequireDefault(require("./week-day-grid"));
21
+
14
22
  /** @jsx jsx */
15
- var dayNameGridStyles = (0, _react2.css)({
16
- display: 'grid',
17
- gridTemplateColumns: 'repeat(7, 1fr)',
18
- border: 0
19
- });
20
- var dayNameCellStyles = (0, _react2.css)({
21
- boxSizing: 'border-box',
22
- minWidth: 40,
23
- padding: "var(--ds-scale-100, 8px)".concat(" ", "var(--ds-scale-100, 8px)"),
24
- border: 0,
25
- color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
26
- fontSize: 11,
27
- fontWeight: 700,
28
- textAlign: 'center',
29
- textTransform: 'uppercase',
30
- whiteSpace: 'nowrap'
31
- });
32
23
  var WeekHeader = /*#__PURE__*/(0, _react.memo)(function WeekHeader(_ref) {
33
24
  var daysShort = _ref.daysShort;
34
- return (0, _react2.jsx)("div", {
35
- css: dayNameGridStyles
36
- }, daysShort.map(function (shortDay) {
37
- return (0, _react2.jsx)("span", {
38
- css: dayNameCellStyles,
25
+ return (0, _react2.jsx)(_weekDayGrid.default, null, daysShort.map(function (shortDay) {
26
+ return (0, _react2.jsx)(_box.default, {
27
+ padding: "scale.100",
28
+ display: "block",
29
+ UNSAFE_style: {
30
+ minWidth: 40,
31
+ // Account for languages with short week day names
32
+ whiteSpace: 'nowrap',
33
+ // Account for languages with long week day names
34
+ textAlign: 'center',
35
+ lineHeight: '16px',
36
+ color: "var(--ds-text-subtle, ".concat(_colors.N200, ")") // Apply correct fallback to shortDay text
37
+
38
+ },
39
39
  key: shortDay
40
- }, shortDay);
40
+ }, (0, _react2.jsx)(_text.default, {
41
+ fontWeight: "700",
42
+ fontSize: "11px",
43
+ verticalAlign: "middle",
44
+ textTransform: "uppercase"
45
+ }, shortDay));
41
46
  }));
42
47
  });
43
48
  WeekHeader.displayName = 'WeekHeader'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -45,14 +45,14 @@ var dateCellStyles = function dateCellStyles() {
45
45
  borderRadius: 3,
46
46
  color: textColor[mode],
47
47
  cursor: 'pointer',
48
- fontSize: 14,
48
+ fontSize: "var(--ds-font-size-100, 14px)",
49
49
  textAlign: 'center',
50
50
  '&[data-sibling]': {
51
51
  color: "var(--ds-text-subtlest, ".concat(_colors.N200, ")")
52
52
  },
53
53
  '&[data-today]': {
54
54
  color: todayColor[mode],
55
- fontWeight: 'bold',
55
+ fontWeight: "var(--ds-font-weight-bold, bold)",
56
56
  '&::after': {
57
57
  display: 'block',
58
58
  height: 2,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/calendar",
3
- "version": "12.4.5",
3
+ "version": "13.0.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,13 +2,14 @@ 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/react';
5
+ import { jsx } from '@emotion/react';
6
6
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
7
+ import Box from '@atlaskit/ds-explorations/box';
8
+ import Stack from '@atlaskit/ds-explorations/stack';
7
9
  import noop from '@atlaskit/ds-lib/noop';
8
- import { DN600, N0, N700, N900 } from '@atlaskit/theme/colors';
9
10
  import GlobalTheme from '@atlaskit/theme/components';
10
11
  import VisuallyHidden from '@atlaskit/visually-hidden';
11
- import HeadingComponent from './internal/components/heading';
12
+ import Header from './internal/components/header';
12
13
  import WeekDaysComponent from './internal/components/week-days';
13
14
  import WeekHeaderComponent from './internal/components/week-header';
14
15
  import { blankStringArray } from './internal/constants';
@@ -20,38 +21,10 @@ import useHandleDateChange from './internal/hooks/use-handle-date-change';
20
21
  import useHandleDateSelect from './internal/hooks/use-handle-date-select';
21
22
  import useLocale from './internal/hooks/use-locale';
22
23
  import useUniqueId from './internal/hooks/use-unique-id';
23
- const lightWrapperStyles = css({
24
- display: 'inline-block',
25
- boxSizing: 'border-box',
26
- // TODO Delete this comment after verifying spacing token -> previous value `16`
27
- padding: "var(--ds-scale-200, 16px)",
28
- backgroundColor: `var(--ds-UNSAFE_util-transparent, ${N0})`,
29
- color: `var(--ds-text, ${N900})`,
30
- outline: 'none',
31
- userSelect: 'none'
32
- });
33
- const darkWrapperStyles = css({
34
- display: 'inline-block',
35
- boxSizing: 'border-box',
36
- // TODO Delete this comment after verifying spacing token -> previous value `16`
37
- padding: "var(--ds-scale-200, 16px)",
38
- backgroundColor: `var(--ds-UNSAFE_util-transparent, ${N700})`,
39
- color: `var(--ds-text, ${DN600})`,
40
- outline: 'none',
41
- userSelect: 'none'
42
- });
43
- const gridsContainerStyles = css({
44
- display: 'inline-block',
45
- width: 289,
46
- // TODO Delete this comment after verifying spacing token -> previous value `0`
47
- margin: "var(--ds-scale-0, 0px)",
48
- marginBottom: 5,
49
- textAlign: 'center'
50
- });
51
24
  const analyticsAttributes = {
52
25
  componentName: 'calendar',
53
26
  packageName: "@atlaskit/calendar",
54
- packageVersion: "12.4.5"
27
+ packageVersion: "13.0.1"
55
28
  };
56
29
  const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
57
30
  day,
@@ -80,7 +53,7 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
80
53
  weekStartDay = 0,
81
54
  testId,
82
55
  calendarRef,
83
- mode,
56
+ mode = 'light',
84
57
  className,
85
58
  style,
86
59
  tabIndex = 0
@@ -171,26 +144,33 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
171
144
  locale,
172
145
  weekStartDay
173
146
  });
174
- return jsx("div", {
147
+ return jsx(Box, {
175
148
  className: className,
176
- style: style,
149
+ UNSAFE_style: style,
150
+ backgroundColor: "elevation.surface",
177
151
  onBlur: handleContainerBlur,
178
152
  onFocus: handleContainerFocus,
179
153
  onKeyDown: handleContainerKeyDown,
180
154
  role: "presentation",
181
- "data-testid": testId && `${testId}--container`,
155
+ testId: testId && `${testId}--container`,
182
156
  ref: ref
183
157
  }, jsx(VisuallyHidden, null, jsx("span", {
184
158
  id: announceId,
185
159
  "aria-live": "assertive",
186
160
  "aria-relevant": "text"
187
- }, announcerDate)), jsx("div", {
188
- css: !mode || mode === 'light' ? lightWrapperStyles : darkWrapperStyles,
161
+ }, announcerDate)), jsx(Box, {
162
+ display: "inlineBlock",
163
+ padding: "scale.200",
164
+ UNSAFE_style: {
165
+ userSelect: 'none'
166
+ },
189
167
  "aria-describedby": announceId,
190
168
  "aria-label": "calendar",
191
169
  role: "grid",
192
170
  tabIndex: tabIndex
193
- }, jsx(HeadingComponent // The month number needs to be translated to index in the month
171
+ }, jsx(Stack, {
172
+ gap: "scale.150"
173
+ }, jsx(Header // The month number needs to be translated to index in the month
194
174
  // name array e.g. 1 (January) -> 0
195
175
  , {
196
176
  monthLongTitle: monthsLong[monthValue - 1],
@@ -201,8 +181,8 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
201
181
  handleClickPrev: handleClickPrev,
202
182
  mode: mode,
203
183
  testId: testId
204
- }), jsx("div", {
205
- css: gridsContainerStyles,
184
+ }), jsx(Box, {
185
+ display: "block",
206
186
  role: "presentation"
207
187
  }, jsx(WeekHeaderComponent, {
208
188
  daysShort: daysShort,
@@ -212,7 +192,7 @@ const CalendarWithMode = /*#__PURE__*/forwardRef(function Calendar({
212
192
  handleClickDay: handleClickDay,
213
193
  mode: mode,
214
194
  testId: testId
215
- }))));
195
+ })))));
216
196
  });
217
197
  /**
218
198
  * __Calendar__
@@ -48,23 +48,25 @@ const Date = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Date({
48
48
  }
49
49
  }, [onClick]);
50
50
  const dateCellStyles = useMemo(() => css(getDateCellStyles(mode)), [mode]);
51
- return jsx("button", {
52
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
53
- css: dateCellStyles,
54
- "aria-selected": isSelected ? 'true' : 'false',
55
- tabIndex: isSelected ? 0 : -1,
56
- type: "button",
57
- role: "gridcell",
58
- onClick: handleClick,
59
- ref: ref,
60
- "data-disabled": isDisabled || undefined,
61
- "data-focused": isFocused || undefined,
62
- "data-prev-selected": isPreviouslySelected || undefined,
63
- "data-selected": isSelected || undefined,
64
- "data-sibling": isSibling || undefined,
65
- "data-today": isToday || undefined,
66
- "data-testid": testId && isSelected ? `${testId}--selected-day` : undefined
67
- }, day);
51
+ return (// eslint-disable-next-line @repo/internal/react/use-primitives
52
+ jsx("button", {
53
+ // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
54
+ css: dateCellStyles,
55
+ "aria-selected": isSelected ? 'true' : 'false',
56
+ tabIndex: isSelected ? 0 : -1,
57
+ type: "button",
58
+ role: "gridcell",
59
+ onClick: handleClick,
60
+ ref: ref,
61
+ "data-disabled": isDisabled || undefined,
62
+ "data-focused": isFocused || undefined,
63
+ "data-prev-selected": isPreviouslySelected || undefined,
64
+ "data-selected": isSelected || undefined,
65
+ "data-sibling": isSibling || undefined,
66
+ "data-today": isToday || undefined,
67
+ "data-testid": testId && isSelected ? `${testId}--selected-day` : undefined
68
+ }, day)
69
+ );
68
70
  }));
69
71
  Date.displayName = 'Date'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
70
72