@atlaskit/calendar 14.2.2 → 14.3.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 (34) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/README.md +2 -1
  3. package/__perf__/examples.tsx +53 -70
  4. package/codemods/11.0.0-lite-mode.tsx +2 -2
  5. package/codemods/__tests__/11.0.0-lite-mode.tsx +21 -21
  6. package/codemods/__tests__/flatten-certain-inner-props-as-prop.tsx +29 -31
  7. package/codemods/__tests__/remove-inner-props.tsx +28 -28
  8. package/codemods/migrations/flatten-certain-inner-props-as-prop.tsx +3 -3
  9. package/codemods/utils.tsx +148 -173
  10. package/dist/cjs/calendar.js +4 -2
  11. package/dist/cjs/internal/components/date.js +7 -0
  12. package/dist/cjs/internal/components/header.js +5 -0
  13. package/dist/cjs/internal/components/week-day-grid.js +5 -0
  14. package/dist/cjs/internal/components/week-days.js +5 -0
  15. package/dist/cjs/internal/components/week-header.js +5 -0
  16. package/dist/cjs/internal/styles/date.js +2 -0
  17. package/dist/es2019/calendar.js +6 -1
  18. package/dist/es2019/internal/components/date.js +7 -0
  19. package/dist/es2019/internal/components/header.js +5 -0
  20. package/dist/es2019/internal/components/week-day-grid.js +4 -0
  21. package/dist/es2019/internal/components/week-days.js +5 -0
  22. package/dist/es2019/internal/components/week-header.js +5 -0
  23. package/dist/es2019/internal/styles/date.js +2 -0
  24. package/dist/esm/calendar.js +6 -1
  25. package/dist/esm/internal/components/date.js +7 -0
  26. package/dist/esm/internal/components/header.js +5 -0
  27. package/dist/esm/internal/components/week-day-grid.js +4 -0
  28. package/dist/esm/internal/components/week-days.js +5 -0
  29. package/dist/esm/internal/components/week-header.js +5 -0
  30. package/dist/esm/internal/styles/date.js +2 -0
  31. package/dist/types/internal/components/week-day-grid.d.ts +3 -0
  32. package/dist/types-ts4.5/internal/components/week-day-grid.d.ts +3 -0
  33. package/package.json +98 -98
  34. package/report.api.md +77 -76
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/calendar
2
2
 
3
+ ## 14.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#111878](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/111878)
8
+ [`223959ef57c80`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/223959ef57c80) -
9
+ Explicitly set jsxRuntime to classic via pragma comments in order to avoid issues where jsxRuntime
10
+ is implicitly set to automatic.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 14.2.2
4
17
 
5
18
  ### Patch Changes
@@ -18,7 +31,7 @@
18
31
 
19
32
  - [#90213](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90213)
20
33
  [`aa06d98a6384`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aa06d98a6384) -
21
- Add support for React 18.
34
+ Add support for React 18 in non-strict mode.
22
35
 
23
36
  ## 14.1.0
24
37
 
package/README.md CHANGED
@@ -13,4 +13,5 @@ yarn add @atlaskit/calendar
13
13
 
14
14
  ## Usage
15
15
 
16
- Detailed docs and example usage can be found [here](https://atlaskit.atlassian.com/packages/core/calendar).
16
+ Detailed docs and example usage can be found
17
+ [here](https://atlaskit.atlassian.com/packages/core/calendar).
@@ -1,90 +1,73 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { fireEvent } from '@testing-library/dom';
4
- import {
5
- type InteractionTaskArgs,
6
- type PublicInteractionTask,
7
- } from 'storybook-addon-performance';
4
+ import { type InteractionTaskArgs, type PublicInteractionTask } from 'storybook-addon-performance';
8
5
 
9
6
  import Calendar from '../src';
10
7
 
11
8
  const testId = 'calendar-test-id';
12
9
 
13
- const getLastElement = (
14
- container: HTMLElement,
15
- testIdAttributeValue: string,
16
- ) => {
17
- const elements = container.querySelectorAll(
18
- `[data-testId="${testIdAttributeValue}"]`,
19
- );
20
- return elements[elements.length - 1];
10
+ const getLastElement = (container: HTMLElement, testIdAttributeValue: string) => {
11
+ const elements = container.querySelectorAll(`[data-testId="${testIdAttributeValue}"]`);
12
+ return elements[elements.length - 1];
21
13
  };
22
14
 
23
15
  const CalendarPerformance = () => {
24
- return (
25
- <Calendar
26
- disabled={['2020-12-04']}
27
- defaultPreviouslySelected={['2020-12-06']}
28
- defaultSelected={['2020-12-18']}
29
- defaultMonth={12}
30
- defaultYear={2020}
31
- testId={testId}
32
- />
33
- );
16
+ return (
17
+ <Calendar
18
+ disabled={['2020-12-04']}
19
+ defaultPreviouslySelected={['2020-12-06']}
20
+ defaultSelected={['2020-12-18']}
21
+ defaultMonth={12}
22
+ defaultYear={2020}
23
+ testId={testId}
24
+ />
25
+ );
34
26
  };
35
27
 
36
28
  const interactionTasks: PublicInteractionTask[] = [
37
- {
38
- name: 'onFocus',
39
- description: 'Render calendar and focus on it',
40
- run: async ({ container }: InteractionTaskArgs): Promise<void> => {
41
- const calendarContainer = getLastElement(
42
- container,
43
- `${testId}--container`,
44
- );
45
- fireEvent.focus(calendarContainer);
46
- },
47
- },
48
- {
49
- name: 'onBlur',
50
- description: 'Render calendar and remove focus',
51
- run: async ({ container }: InteractionTaskArgs): Promise<void> => {
52
- const calendarContainer = getLastElement(
53
- container,
54
- `${testId}--container`,
55
- );
56
- fireEvent.focus(calendarContainer);
57
- fireEvent.blur(calendarContainer);
58
- },
59
- },
60
- {
61
- name: 'onChange',
62
- description: 'Render calendar and change month',
63
- run: async ({ container }: InteractionTaskArgs): Promise<void> => {
64
- const nextMonthButton = getLastElement(
65
- container,
66
- `${testId}--next-month`,
67
- );
68
- fireEvent.click(nextMonthButton);
69
- },
70
- },
71
- {
72
- name: 'onSelect',
73
- description: 'Render calendar and click on day(date) cell',
74
- run: async ({ container }: InteractionTaskArgs): Promise<void> => {
75
- const dateCell = getLastElement(container, `${testId}--selected-day`);
76
- fireEvent.click(dateCell);
77
- },
78
- },
29
+ {
30
+ name: 'onFocus',
31
+ description: 'Render calendar and focus on it',
32
+ run: async ({ container }: InteractionTaskArgs): Promise<void> => {
33
+ const calendarContainer = getLastElement(container, `${testId}--container`);
34
+ fireEvent.focus(calendarContainer);
35
+ },
36
+ },
37
+ {
38
+ name: 'onBlur',
39
+ description: 'Render calendar and remove focus',
40
+ run: async ({ container }: InteractionTaskArgs): Promise<void> => {
41
+ const calendarContainer = getLastElement(container, `${testId}--container`);
42
+ fireEvent.focus(calendarContainer);
43
+ fireEvent.blur(calendarContainer);
44
+ },
45
+ },
46
+ {
47
+ name: 'onChange',
48
+ description: 'Render calendar and change month',
49
+ run: async ({ container }: InteractionTaskArgs): Promise<void> => {
50
+ const nextMonthButton = getLastElement(container, `${testId}--next-month`);
51
+ fireEvent.click(nextMonthButton);
52
+ },
53
+ },
54
+ {
55
+ name: 'onSelect',
56
+ description: 'Render calendar and click on day(date) cell',
57
+ run: async ({ container }: InteractionTaskArgs): Promise<void> => {
58
+ const dateCell = getLastElement(container, `${testId}--selected-day`);
59
+ fireEvent.click(dateCell);
60
+ },
61
+ },
79
62
  ];
80
63
 
81
64
  CalendarPerformance.story = {
82
- name: 'calendar',
83
- parameters: {
84
- performance: {
85
- interactions: interactionTasks,
86
- },
87
- },
65
+ name: 'calendar',
66
+ parameters: {
67
+ performance: {
68
+ interactions: interactionTasks,
69
+ },
70
+ },
88
71
  };
89
72
 
90
73
  export default CalendarPerformance;
@@ -3,8 +3,8 @@ import { removeInnerProps } from './migrations/remove-inner-props';
3
3
  import { createTransformer } from './utils';
4
4
 
5
5
  const transformer = createTransformer('@atlaskit/calendar', [
6
- flattenCertainInnerPropsAsProp,
7
- removeInnerProps,
6
+ flattenCertainInnerPropsAsProp,
7
+ removeInnerProps,
8
8
  ]);
9
9
 
10
10
  export default transformer;
@@ -5,10 +5,10 @@ import transformer from '../11.0.0-lite-mode';
5
5
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
6
6
 
7
7
  describe('Calendar code-mods', () => {
8
- defineInlineTest(
9
- { default: transformer, parser: 'tsx' },
10
- {},
11
- `
8
+ defineInlineTest(
9
+ { default: transformer, parser: 'tsx' },
10
+ {},
11
+ `
12
12
  import React from 'react';
13
13
  import Calendar from '@atlaskit/calendar';
14
14
 
@@ -32,7 +32,7 @@ describe('Calendar code-mods', () => {
32
32
  );
33
33
  }
34
34
  `,
35
- `
35
+ `
36
36
  /* TODO: (from codemod) This file uses the @atlaskit/calendar \`innerProps\` which
37
37
  has now been removed due to its poor performance characteristics. Codemod
38
38
  has auto flattened 'className' & 'style' properties inside it if present as a standalone props to calendar.
@@ -58,13 +58,13 @@ describe('Calendar code-mods', () => {
58
58
  );
59
59
  }
60
60
  `,
61
- `should flatten style & className in innerProps as standalone prop
61
+ `should flatten style & className in innerProps as standalone prop
62
62
  & then remove innerProps`,
63
- );
64
- defineInlineTest(
65
- { default: transformer, parser: 'tsx' },
66
- {},
67
- `
63
+ );
64
+ defineInlineTest(
65
+ { default: transformer, parser: 'tsx' },
66
+ {},
67
+ `
68
68
  import React from 'react';
69
69
  import Calendar from '@atlaskit/calendar';
70
70
 
@@ -89,7 +89,7 @@ describe('Calendar code-mods', () => {
89
89
  );
90
90
  }
91
91
  `,
92
- `
92
+ `
93
93
  /* TODO: (from codemod) This file uses the @atlaskit/calendar \`innerProps\` which
94
94
  has now been removed due to its poor performance characteristics. Codemod
95
95
  has auto flattened 'className' & 'style' properties inside it if present as a standalone props to calendar.
@@ -115,13 +115,13 @@ describe('Calendar code-mods', () => {
115
115
  );
116
116
  }
117
117
  `,
118
- `should only flatten style & className in innerProps as standalone prop
118
+ `should only flatten style & className in innerProps as standalone prop
119
119
  & then remove innerProps`,
120
- );
121
- defineInlineTest(
122
- { default: transformer, parser: 'tsx' },
123
- {},
124
- `
120
+ );
121
+ defineInlineTest(
122
+ { default: transformer, parser: 'tsx' },
123
+ {},
124
+ `
125
125
  import React from 'react';
126
126
  import Calendar from '@atlaskit/calendar';
127
127
  const SimpleCalendar= () => {
@@ -140,7 +140,7 @@ describe('Calendar code-mods', () => {
140
140
  );
141
141
  }
142
142
  `,
143
- `
143
+ `
144
144
  /* TODO: (from codemod) This file uses the @atlaskit/calendar \`innerProps\` which
145
145
  has now been removed due to its poor performance characteristics. Codemod
146
146
  has auto flattened 'className' & 'style' properties inside it if present as a standalone props to calendar.
@@ -160,7 +160,7 @@ describe('Calendar code-mods', () => {
160
160
  );
161
161
  }
162
162
  `,
163
- `should not flatten any other prop apart from style & className in innerProps
163
+ `should not flatten any other prop apart from style & className in innerProps
164
164
  & just remove innerProps`,
165
- );
165
+ );
166
166
  });
@@ -3,17 +3,15 @@ jest.autoMockOff();
3
3
  import { flattenCertainInnerPropsAsProp } from '../migrations/flatten-certain-inner-props-as-prop';
4
4
  import { createTransformer } from '../utils';
5
5
 
6
- const transformer = createTransformer('@atlaskit/calendar', [
7
- flattenCertainInnerPropsAsProp,
8
- ]);
6
+ const transformer = createTransformer('@atlaskit/calendar', [flattenCertainInnerPropsAsProp]);
9
7
 
10
8
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
11
9
 
12
10
  describe('Flatten Inner Prop Style As Prop', () => {
13
- defineInlineTest(
14
- { default: transformer, parser: 'tsx' },
15
- {},
16
- `
11
+ defineInlineTest(
12
+ { default: transformer, parser: 'tsx' },
13
+ {},
14
+ `
17
15
  import React from 'react';
18
16
  import Calendar from '@atlaskit/calendar';
19
17
  const SimpleCalendar = () => {
@@ -30,7 +28,7 @@ describe('Flatten Inner Prop Style As Prop', () => {
30
28
  )
31
29
  };
32
30
  `,
33
- `
31
+ `
34
32
  import React from 'react';
35
33
  import Calendar from '@atlaskit/calendar';
36
34
  const SimpleCalendar = () => {
@@ -51,12 +49,12 @@ describe('Flatten Inner Prop Style As Prop', () => {
51
49
  );
52
50
  };
53
51
  `,
54
- 'should flatten style & className properties in inner props as a new standalone props',
55
- );
56
- defineInlineTest(
57
- { default: transformer, parser: 'tsx' },
58
- {},
59
- `
52
+ 'should flatten style & className properties in inner props as a new standalone props',
53
+ );
54
+ defineInlineTest(
55
+ { default: transformer, parser: 'tsx' },
56
+ {},
57
+ `
60
58
  import React from 'react';
61
59
  import Calendar from '@atlaskit/calendar';
62
60
  const SimpleCalendar = () => {
@@ -69,7 +67,7 @@ describe('Flatten Inner Prop Style As Prop', () => {
69
67
  )
70
68
  };
71
69
  `,
72
- `
70
+ `
73
71
  import React from 'react';
74
72
  import Calendar from '@atlaskit/calendar';
75
73
  const SimpleCalendar = () => {
@@ -82,12 +80,12 @@ describe('Flatten Inner Prop Style As Prop', () => {
82
80
  );
83
81
  };
84
82
  `,
85
- 'should just flatten className property in inner props as a new standalone prop',
86
- );
87
- defineInlineTest(
88
- { default: transformer, parser: 'tsx' },
89
- {},
90
- `
83
+ 'should just flatten className property in inner props as a new standalone prop',
84
+ );
85
+ defineInlineTest(
86
+ { default: transformer, parser: 'tsx' },
87
+ {},
88
+ `
91
89
  import React from 'react';
92
90
  import Calendar from '@atlaskit/calendar';
93
91
  const SimpleCalendar = () => {
@@ -103,7 +101,7 @@ describe('Flatten Inner Prop Style As Prop', () => {
103
101
  )
104
102
  };
105
103
  `,
106
- `
104
+ `
107
105
  import React from 'react';
108
106
  import Calendar from '@atlaskit/calendar';
109
107
  const SimpleCalendar = () => {
@@ -122,12 +120,12 @@ describe('Flatten Inner Prop Style As Prop', () => {
122
120
  );
123
121
  };
124
122
  `,
125
- 'should just flatten style property in inner props as a new standalone prop',
126
- );
127
- defineInlineTest(
128
- { default: transformer, parser: 'tsx' },
129
- {},
130
- `
123
+ 'should just flatten style property in inner props as a new standalone prop',
124
+ );
125
+ defineInlineTest(
126
+ { default: transformer, parser: 'tsx' },
127
+ {},
128
+ `
131
129
  import React from 'react';
132
130
  import Calendar from '@atlaskit/calendar';
133
131
  const SimpleCalendar = () => {
@@ -140,7 +138,7 @@ describe('Flatten Inner Prop Style As Prop', () => {
140
138
  )
141
139
  };
142
140
  `,
143
- `
141
+ `
144
142
  import React from 'react';
145
143
  import Calendar from '@atlaskit/calendar';
146
144
  const SimpleCalendar = () => {
@@ -153,6 +151,6 @@ describe('Flatten Inner Prop Style As Prop', () => {
153
151
  )
154
152
  };
155
153
  `,
156
- 'should not flatten any other prop in inner props if className & style prop is not present',
157
- );
154
+ 'should not flatten any other prop in inner props if className & style prop is not present',
155
+ );
158
156
  });
@@ -8,10 +8,10 @@ const transformer = createTransformer('@atlaskit/calendar', [removeInnerProps]);
8
8
  const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
9
9
 
10
10
  describe('Remove innerProps', () => {
11
- defineInlineTest(
12
- { default: transformer, parser: 'tsx' },
13
- {},
14
- `
11
+ defineInlineTest(
12
+ { default: transformer, parser: 'tsx' },
13
+ {},
14
+ `
15
15
  import React from 'react';
16
16
  import Calendar from '@atlaskit/calendar';
17
17
 
@@ -28,7 +28,7 @@ describe('Remove innerProps', () => {
28
28
  );
29
29
  }
30
30
  `,
31
- `
31
+ `
32
32
  /* TODO: (from codemod) This file uses the @atlaskit/calendar \`innerProps\` which
33
33
  has now been removed due to its poor performance characteristics. Codemod
34
34
  has auto flattened 'className' & 'style' properties inside it if present as a standalone props to calendar.
@@ -41,13 +41,13 @@ describe('Remove innerProps', () => {
41
41
  return <Calendar />;
42
42
  }
43
43
  `,
44
- 'should remove innerProps from Calendar and leave a TODO comment',
45
- );
44
+ 'should remove innerProps from Calendar and leave a TODO comment',
45
+ );
46
46
 
47
- defineInlineTest(
48
- { default: transformer, parser: 'tsx' },
49
- {},
50
- `
47
+ defineInlineTest(
48
+ { default: transformer, parser: 'tsx' },
49
+ {},
50
+ `
51
51
  import React from 'react';
52
52
  import AkCalendar from '@atlaskit/calendar';
53
53
 
@@ -64,7 +64,7 @@ describe('Remove innerProps', () => {
64
64
  );
65
65
  }
66
66
  `,
67
- `
67
+ `
68
68
  /* TODO: (from codemod) This file uses the @atlaskit/calendar \`innerProps\` which
69
69
  has now been removed due to its poor performance characteristics. Codemod
70
70
  has auto flattened 'className' & 'style' properties inside it if present as a standalone props to calendar.
@@ -77,13 +77,13 @@ describe('Remove innerProps', () => {
77
77
  return <AkCalendar />;
78
78
  }
79
79
  `,
80
- 'should also remove innerProps from some random default import name of Calendar (eg: AkCalendar) and leave a TODO comment',
81
- );
80
+ 'should also remove innerProps from some random default import name of Calendar (eg: AkCalendar) and leave a TODO comment',
81
+ );
82
82
 
83
- defineInlineTest(
84
- { default: transformer, parser: 'tsx' },
85
- {},
86
- `
83
+ defineInlineTest(
84
+ { default: transformer, parser: 'tsx' },
85
+ {},
86
+ `
87
87
  import React from 'react';
88
88
  import Calendar from '@atlaskit/calendar';
89
89
 
@@ -103,7 +103,7 @@ describe('Remove innerProps', () => {
103
103
  );
104
104
  }
105
105
  `,
106
- `
106
+ `
107
107
  /* TODO: (from codemod) This file uses the @atlaskit/calendar \`innerProps\` which
108
108
  has now been removed due to its poor performance characteristics. Codemod
109
109
  has auto flattened 'className' & 'style' properties inside it if present as a standalone props to calendar.
@@ -121,13 +121,13 @@ describe('Remove innerProps', () => {
121
121
  );
122
122
  }
123
123
  `,
124
- 'should remove innerProps from Calendar, leave a TODO comment & just keep other props intact',
125
- );
124
+ 'should remove innerProps from Calendar, leave a TODO comment & just keep other props intact',
125
+ );
126
126
 
127
- defineInlineTest(
128
- { default: transformer, parser: 'tsx' },
129
- {},
130
- `
127
+ defineInlineTest(
128
+ { default: transformer, parser: 'tsx' },
129
+ {},
130
+ `
131
131
  import React from 'react';
132
132
  import Calendar from '@atlaskit/calendar';
133
133
 
@@ -141,7 +141,7 @@ describe('Remove innerProps', () => {
141
141
  );
142
142
  }
143
143
  `,
144
- `
144
+ `
145
145
  import React from 'react';
146
146
  import Calendar from '@atlaskit/calendar';
147
147
 
@@ -155,6 +155,6 @@ describe('Remove innerProps', () => {
155
155
  );
156
156
  }
157
157
  `,
158
- 'should not remove & leave a TODO comment when innerProps is itself not present',
159
- );
158
+ 'should not remove & leave a TODO comment when innerProps is itself not present',
159
+ );
160
160
  });
@@ -5,7 +5,7 @@ const prop = 'innerProps';
5
5
  const childProps = ['style', 'className'];
6
6
 
7
7
  export const flattenCertainInnerPropsAsProp = flattenCertainChildPropsAsProp(
8
- component,
9
- prop,
10
- childProps,
8
+ component,
9
+ prop,
10
+ childProps,
11
11
  );