@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.
Files changed (29) hide show
  1. package/CHANGELOG.md +20 -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/version.json +1 -1
  9. package/dist/es2019/calendar.js +22 -42
  10. package/dist/es2019/internal/components/date.js +19 -17
  11. package/dist/es2019/internal/components/header.js +60 -0
  12. package/dist/es2019/internal/components/week-day-grid.js +23 -0
  13. package/dist/es2019/internal/components/week-days.js +7 -15
  14. package/dist/es2019/internal/components/week-header.js +23 -23
  15. package/dist/es2019/version.json +1 -1
  16. package/dist/esm/calendar.js +23 -42
  17. package/dist/esm/internal/components/date.js +19 -17
  18. package/dist/esm/internal/components/header.js +61 -0
  19. package/dist/esm/internal/components/week-day-grid.js +25 -0
  20. package/dist/esm/internal/components/week-days.js +7 -15
  21. package/dist/esm/internal/components/week-header.js +24 -24
  22. package/dist/esm/version.json +1 -1
  23. package/dist/types/calendar.d.ts +1 -1
  24. package/dist/types/internal/components/{heading.d.ts → header.d.ts} +3 -3
  25. package/dist/types/internal/components/week-day-grid.d.ts +15 -0
  26. package/package.json +11 -4
  27. package/report.api.md +1 -1
  28. package/dist/es2019/internal/components/heading.js +0 -82
  29. package/dist/esm/internal/components/heading.js +0 -88
@@ -1,82 +0,0 @@
1
- /** @jsx jsx */
2
- import { memo, useMemo } from 'react';
3
- import { css, jsx } from '@emotion/react';
4
- import Button from '@atlaskit/button/standard-button';
5
- import ArrowleftIcon from '@atlaskit/icon/glyph/chevron-left-large';
6
- import ArrowrightIcon from '@atlaskit/icon/glyph/chevron-right-large';
7
- import { DN800, N70, N800 } from '@atlaskit/theme/colors';
8
- const headingColor = {
9
- light: `var(--ds-text, ${N800})`,
10
- dark: `var(--ds-text, ${DN800})`
11
- };
12
- const headingStyles = css({
13
- display: 'flex',
14
- // TODO Delete this comment after verifying spacing tokens
15
- padding: `${"var(--ds-scale-0, 0px)"} ${"var(--ds-scale-0, 0px)"} 13px ${"var(--ds-scale-0, 0px)"}`,
16
- color: `var(--ds-text, ${N800})`,
17
- fontWeight: 'bold'
18
- });
19
-
20
- const getMonthAndYearStyles = (mode = 'light') => css({
21
- flexBasis: '100%',
22
- color: headingColor[mode],
23
- textAlign: 'center'
24
- });
25
-
26
- const arrowLeftStyles = css({
27
- // TODO Delete this comment after verifying spacing token -> previous value `8`
28
- marginLeft: "var(--ds-scale-100, 8px)"
29
- });
30
- const arrowRightStyles = css({
31
- // TODO Delete this comment after verifying spacing token -> previous value `8`
32
- marginRight: "var(--ds-scale-100, 8px)"
33
- });
34
- const Heading = /*#__PURE__*/memo(function Heading({
35
- monthLongTitle,
36
- year,
37
- previousMonthLabel = 'Last month',
38
- nextMonthLabel = 'Next month',
39
- handleClickPrev,
40
- handleClickNext,
41
- mode,
42
- testId
43
- }) {
44
- const monthAndYearStyles = useMemo(() => getMonthAndYearStyles(mode), [mode]);
45
- return jsx("div", {
46
- css: headingStyles,
47
- "aria-hidden": "true"
48
- }, jsx(Button, {
49
- css: arrowLeftStyles,
50
- appearance: "subtle",
51
- spacing: "none",
52
- tabIndex: -1,
53
- onClick: handleClickPrev,
54
- testId: testId && `${testId}--previous-month`,
55
- iconBefore: jsx(ArrowleftIcon, {
56
- label: previousMonthLabel,
57
- size: "medium",
58
- primaryColor: `var(--ds-text-subtlest, ${N70})`,
59
- testId: testId && `${testId}--previous-month-icon`
60
- })
61
- }), jsx("div", {
62
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
63
- css: monthAndYearStyles,
64
- "data-testid": testId && `${testId}--current-month-year`
65
- }, `${monthLongTitle} ${year}`), jsx(Button, {
66
- css: arrowRightStyles,
67
- appearance: "subtle",
68
- spacing: "none",
69
- tabIndex: -1,
70
- onClick: handleClickNext,
71
- testId: testId && `${testId}--next-month`,
72
- iconBefore: jsx(ArrowrightIcon, {
73
- label: nextMonthLabel,
74
- size: "medium",
75
- primaryColor: `var(--ds-text-subtlest, ${N70})`,
76
- testId: testId && `${testId}--next-month-icon`
77
- })
78
- }));
79
- });
80
- Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
81
-
82
- export default Heading;
@@ -1,88 +0,0 @@
1
- /** @jsx jsx */
2
- import { memo, useMemo } from 'react';
3
- import { css, jsx } from '@emotion/react';
4
- import Button from '@atlaskit/button/standard-button';
5
- import ArrowleftIcon from '@atlaskit/icon/glyph/chevron-left-large';
6
- import ArrowrightIcon from '@atlaskit/icon/glyph/chevron-right-large';
7
- import { DN800, N70, N800 } from '@atlaskit/theme/colors';
8
- var headingColor = {
9
- light: "var(--ds-text, ".concat(N800, ")"),
10
- dark: "var(--ds-text, ".concat(DN800, ")")
11
- };
12
- var headingStyles = css({
13
- display: 'flex',
14
- // TODO Delete this comment after verifying spacing tokens
15
- padding: "var(--ds-scale-0, 0px)".concat(" ", "var(--ds-scale-0, 0px)", " 13px ", "var(--ds-scale-0, 0px)"),
16
- color: "var(--ds-text, ".concat(N800, ")"),
17
- fontWeight: 'bold'
18
- });
19
-
20
- var getMonthAndYearStyles = function getMonthAndYearStyles() {
21
- var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'light';
22
- return css({
23
- flexBasis: '100%',
24
- color: headingColor[mode],
25
- textAlign: 'center'
26
- });
27
- };
28
-
29
- var arrowLeftStyles = css({
30
- // TODO Delete this comment after verifying spacing token -> previous value `8`
31
- marginLeft: "var(--ds-scale-100, 8px)"
32
- });
33
- var arrowRightStyles = css({
34
- // TODO Delete this comment after verifying spacing token -> previous value `8`
35
- marginRight: "var(--ds-scale-100, 8px)"
36
- });
37
- var Heading = /*#__PURE__*/memo(function Heading(_ref) {
38
- var monthLongTitle = _ref.monthLongTitle,
39
- year = _ref.year,
40
- _ref$previousMonthLab = _ref.previousMonthLabel,
41
- previousMonthLabel = _ref$previousMonthLab === void 0 ? 'Last month' : _ref$previousMonthLab,
42
- _ref$nextMonthLabel = _ref.nextMonthLabel,
43
- nextMonthLabel = _ref$nextMonthLabel === void 0 ? 'Next month' : _ref$nextMonthLabel,
44
- handleClickPrev = _ref.handleClickPrev,
45
- handleClickNext = _ref.handleClickNext,
46
- mode = _ref.mode,
47
- testId = _ref.testId;
48
- var monthAndYearStyles = useMemo(function () {
49
- return getMonthAndYearStyles(mode);
50
- }, [mode]);
51
- return jsx("div", {
52
- css: headingStyles,
53
- "aria-hidden": "true"
54
- }, jsx(Button, {
55
- css: arrowLeftStyles,
56
- appearance: "subtle",
57
- spacing: "none",
58
- tabIndex: -1,
59
- onClick: handleClickPrev,
60
- testId: testId && "".concat(testId, "--previous-month"),
61
- iconBefore: jsx(ArrowleftIcon, {
62
- label: previousMonthLabel,
63
- size: "medium",
64
- primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")"),
65
- testId: testId && "".concat(testId, "--previous-month-icon")
66
- })
67
- }), jsx("div", {
68
- // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
69
- css: monthAndYearStyles,
70
- "data-testid": testId && "".concat(testId, "--current-month-year")
71
- }, "".concat(monthLongTitle, " ").concat(year)), jsx(Button, {
72
- css: arrowRightStyles,
73
- appearance: "subtle",
74
- spacing: "none",
75
- tabIndex: -1,
76
- onClick: handleClickNext,
77
- testId: testId && "".concat(testId, "--next-month"),
78
- iconBefore: jsx(ArrowrightIcon, {
79
- label: nextMonthLabel,
80
- size: "medium",
81
- primaryColor: "var(--ds-text-subtlest, ".concat(N70, ")"),
82
- testId: testId && "".concat(testId, "--next-month-icon")
83
- })
84
- }));
85
- });
86
- Heading.displayName = 'Heading'; // eslint-disable-next-line @repo/internal/react/require-jsdoc
87
-
88
- export default Heading;