@instructure/ui-calendar 10.16.1-snapshot-0 → 10.16.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.
- package/CHANGELOG.md +1 -1
- package/es/Calendar/Day/__new-tests__/Day.test.js +89 -71
- package/es/Calendar/Day/index.js +13 -9
- package/es/Calendar/__new-tests__/Calendar.test.js +96 -62
- package/es/Calendar/index.js +94 -74
- package/lib/Calendar/Day/__new-tests__/Day.test.js +96 -78
- package/lib/Calendar/Day/index.js +12 -8
- package/lib/Calendar/__new-tests__/Calendar.test.js +112 -79
- package/lib/Calendar/index.js +93 -74
- package/package.json +20 -20
- package/src/Calendar/Day/__new-tests__/Day.test.tsx +16 -17
- package/src/Calendar/Day/index.tsx +1 -2
- package/src/Calendar/__new-tests__/Calendar.test.tsx +4 -8
- package/src/Calendar/index.tsx +4 -6
- package/src/Calendar/props.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Calendar/Day/__new-tests__/Day.test.d.ts.map +1 -1
- package/types/Calendar/Day/index.d.ts +1 -3
- package/types/Calendar/Day/index.d.ts.map +1 -1
- package/types/Calendar/index.d.ts +8 -10
- package/types/Calendar/index.d.ts.map +1 -1
- package/types/Calendar/props.d.ts +1 -1
- package/types/Calendar/props.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-calendar",
|
|
3
|
-
"version": "10.16.1
|
|
3
|
+
"version": "10.16.1",
|
|
4
4
|
"description": "A calendar component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.16.1
|
|
27
|
-
"@instructure/ui-babel-preset": "10.16.1
|
|
28
|
-
"@instructure/ui-color-utils": "10.16.1
|
|
29
|
-
"@instructure/ui-test-utils": "10.16.1
|
|
30
|
-
"@instructure/ui-themes": "10.16.1
|
|
26
|
+
"@instructure/ui-axe-check": "10.16.1",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.16.1",
|
|
28
|
+
"@instructure/ui-color-utils": "10.16.1",
|
|
29
|
+
"@instructure/ui-test-utils": "10.16.1",
|
|
30
|
+
"@instructure/ui-themes": "10.16.1",
|
|
31
31
|
"@testing-library/jest-dom": "^6.6.3",
|
|
32
32
|
"@testing-library/react": "^16.0.1",
|
|
33
33
|
"@testing-library/user-event": "^14.5.2",
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@babel/runtime": "^7.26.0",
|
|
38
|
-
"@instructure/console": "10.16.1
|
|
39
|
-
"@instructure/emotion": "10.16.1
|
|
40
|
-
"@instructure/shared-types": "10.16.1
|
|
41
|
-
"@instructure/ui-a11y-content": "10.16.1
|
|
42
|
-
"@instructure/ui-buttons": "10.16.1
|
|
43
|
-
"@instructure/ui-i18n": "10.16.1
|
|
44
|
-
"@instructure/ui-icons": "10.16.1
|
|
45
|
-
"@instructure/ui-prop-types": "10.16.1
|
|
46
|
-
"@instructure/ui-react-utils": "10.16.1
|
|
47
|
-
"@instructure/ui-simple-select": "10.16.1
|
|
48
|
-
"@instructure/ui-testable": "10.16.1
|
|
49
|
-
"@instructure/ui-utils": "10.16.1
|
|
50
|
-
"@instructure/ui-view": "10.16.1
|
|
51
|
-
"@instructure/uid": "10.16.1
|
|
38
|
+
"@instructure/console": "10.16.1",
|
|
39
|
+
"@instructure/emotion": "10.16.1",
|
|
40
|
+
"@instructure/shared-types": "10.16.1",
|
|
41
|
+
"@instructure/ui-a11y-content": "10.16.1",
|
|
42
|
+
"@instructure/ui-buttons": "10.16.1",
|
|
43
|
+
"@instructure/ui-i18n": "10.16.1",
|
|
44
|
+
"@instructure/ui-icons": "10.16.1",
|
|
45
|
+
"@instructure/ui-prop-types": "10.16.1",
|
|
46
|
+
"@instructure/ui-react-utils": "10.16.1",
|
|
47
|
+
"@instructure/ui-simple-select": "10.16.1",
|
|
48
|
+
"@instructure/ui-testable": "10.16.1",
|
|
49
|
+
"@instructure/ui-utils": "10.16.1",
|
|
50
|
+
"@instructure/ui-view": "10.16.1",
|
|
51
|
+
"@instructure/uid": "10.16.1",
|
|
52
52
|
"prop-types": "^15.8.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import React from 'react'
|
|
26
25
|
import { render, screen, waitFor } from '@testing-library/react'
|
|
27
26
|
import userEvent from '@testing-library/user-event'
|
|
28
27
|
import { vi } from 'vitest'
|
|
@@ -63,7 +62,7 @@ describe('Day', () => {
|
|
|
63
62
|
</Day>
|
|
64
63
|
)
|
|
65
64
|
const screenReaderContent = container.querySelector(
|
|
66
|
-
'[class
|
|
65
|
+
'[class*="-screenReaderContent"]'
|
|
67
66
|
)
|
|
68
67
|
|
|
69
68
|
expect(screenReaderContent).toBeInTheDocument()
|
|
@@ -76,7 +75,7 @@ describe('Day', () => {
|
|
|
76
75
|
8
|
|
77
76
|
</Day>
|
|
78
77
|
)
|
|
79
|
-
const today = container.querySelector('[class
|
|
78
|
+
const today = container.querySelector('[class*="-calendarDay"]')
|
|
80
79
|
|
|
81
80
|
expect(today).toHaveAttribute('aria-current', 'date')
|
|
82
81
|
|
|
@@ -85,7 +84,7 @@ describe('Day', () => {
|
|
|
85
84
|
8
|
|
86
85
|
</Day>
|
|
87
86
|
)
|
|
88
|
-
const day = container.querySelector('[class
|
|
87
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
89
88
|
|
|
90
89
|
expect(day).not.toHaveAttribute('aria-current', 'date')
|
|
91
90
|
})
|
|
@@ -96,7 +95,7 @@ describe('Day', () => {
|
|
|
96
95
|
8
|
|
97
96
|
</Day>
|
|
98
97
|
)
|
|
99
|
-
const day = container.querySelector('[class
|
|
98
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
100
99
|
|
|
101
100
|
expect(day).not.toHaveAttribute('aria-selected')
|
|
102
101
|
|
|
@@ -105,7 +104,7 @@ describe('Day', () => {
|
|
|
105
104
|
8
|
|
106
105
|
</Day>
|
|
107
106
|
)
|
|
108
|
-
const daySelected = container.querySelector('[class
|
|
107
|
+
const daySelected = container.querySelector('[class*="-calendarDay"]')
|
|
109
108
|
|
|
110
109
|
expect(daySelected).not.toHaveAttribute('aria-selected')
|
|
111
110
|
})
|
|
@@ -116,7 +115,7 @@ describe('Day', () => {
|
|
|
116
115
|
8
|
|
117
116
|
</Day>
|
|
118
117
|
)
|
|
119
|
-
const day = container.querySelector('[class
|
|
118
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
120
119
|
expect(day).toHaveAttribute('aria-selected', 'false')
|
|
121
120
|
|
|
122
121
|
rerender(
|
|
@@ -129,7 +128,7 @@ describe('Day', () => {
|
|
|
129
128
|
8
|
|
130
129
|
</Day>
|
|
131
130
|
)
|
|
132
|
-
const daySelected = container.querySelector('[class
|
|
131
|
+
const daySelected = container.querySelector('[class*="-calendarDay"]')
|
|
133
132
|
expect(daySelected).toHaveAttribute('aria-selected', 'true')
|
|
134
133
|
|
|
135
134
|
rerender(
|
|
@@ -142,7 +141,7 @@ describe('Day', () => {
|
|
|
142
141
|
8
|
|
143
142
|
</Day>
|
|
144
143
|
)
|
|
145
|
-
const dayCell = container.querySelector('[class
|
|
144
|
+
const dayCell = container.querySelector('[class*="-calendarDay"]')
|
|
146
145
|
expect(dayCell).toHaveAttribute('aria-selected', 'false')
|
|
147
146
|
|
|
148
147
|
rerender(
|
|
@@ -155,7 +154,7 @@ describe('Day', () => {
|
|
|
155
154
|
8
|
|
156
155
|
</Day>
|
|
157
156
|
)
|
|
158
|
-
const dayCellSelected = container.querySelector('[class
|
|
157
|
+
const dayCellSelected = container.querySelector('[class*="-calendarDay"]')
|
|
159
158
|
expect(dayCellSelected).toHaveAttribute('aria-selected', 'true')
|
|
160
159
|
})
|
|
161
160
|
|
|
@@ -168,7 +167,7 @@ describe('Day', () => {
|
|
|
168
167
|
8
|
|
169
168
|
</Day>
|
|
170
169
|
)
|
|
171
|
-
const day = container.querySelector('[class
|
|
170
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
172
171
|
|
|
173
172
|
await userEvent.click(day!)
|
|
174
173
|
|
|
@@ -195,7 +194,7 @@ describe('Day', () => {
|
|
|
195
194
|
</Day>
|
|
196
195
|
)
|
|
197
196
|
|
|
198
|
-
const day = container.querySelector('[class
|
|
197
|
+
const day = container.querySelector('[class*="-calendarDay"]')!
|
|
199
198
|
|
|
200
199
|
userEvent.type(day, '{enter}')
|
|
201
200
|
|
|
@@ -220,7 +219,7 @@ describe('Day', () => {
|
|
|
220
219
|
8
|
|
221
220
|
</Day>
|
|
222
221
|
)
|
|
223
|
-
const day = container.querySelector('[class
|
|
222
|
+
const day = container.querySelector('[class*="-calendarDay"]')!
|
|
224
223
|
|
|
225
224
|
userEvent.click(day)
|
|
226
225
|
|
|
@@ -244,7 +243,7 @@ describe('Day', () => {
|
|
|
244
243
|
8
|
|
245
244
|
</Day>
|
|
246
245
|
)
|
|
247
|
-
const day = container.querySelector('[class
|
|
246
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
248
247
|
|
|
249
248
|
expect(day).toEqual(element)
|
|
250
249
|
})
|
|
@@ -256,7 +255,7 @@ describe('Day', () => {
|
|
|
256
255
|
8
|
|
257
256
|
</Day>
|
|
258
257
|
)
|
|
259
|
-
const day = container.querySelector('[class
|
|
258
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
260
259
|
|
|
261
260
|
expect(day?.tagName).toEqual('SPAN')
|
|
262
261
|
})
|
|
@@ -267,7 +266,7 @@ describe('Day', () => {
|
|
|
267
266
|
8
|
|
268
267
|
</Day>
|
|
269
268
|
)
|
|
270
|
-
const day = container.querySelector('[class
|
|
269
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
271
270
|
|
|
272
271
|
expect(day?.tagName).toEqual('BUTTON')
|
|
273
272
|
})
|
|
@@ -283,7 +282,7 @@ describe('Day', () => {
|
|
|
283
282
|
8
|
|
284
283
|
</Day>
|
|
285
284
|
)
|
|
286
|
-
const day = container.querySelector('[class
|
|
285
|
+
const day = container.querySelector('[class*="-calendarDay"]')
|
|
287
286
|
|
|
288
287
|
expect(day?.tagName).toEqual('LI')
|
|
289
288
|
})
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
/** @jsx jsx */
|
|
26
25
|
import { Component, MouseEvent, KeyboardEvent } from 'react'
|
|
27
26
|
|
|
28
27
|
import { View } from '@instructure/ui-view'
|
|
@@ -36,7 +35,7 @@ import {
|
|
|
36
35
|
|
|
37
36
|
import { testable } from '@instructure/ui-testable'
|
|
38
37
|
|
|
39
|
-
import { withStyle
|
|
38
|
+
import { withStyle } from '@instructure/emotion'
|
|
40
39
|
|
|
41
40
|
import generateStyle from './styles'
|
|
42
41
|
import generateComponentTheme from './theme'
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
import { render, screen, waitFor } from '@testing-library/react'
|
|
26
26
|
import userEvent from '@testing-library/user-event'
|
|
27
27
|
import { vi } from 'vitest'
|
|
@@ -140,7 +140,7 @@ describe('<Calendar />', () => {
|
|
|
140
140
|
)
|
|
141
141
|
|
|
142
142
|
const calendarDays = container.querySelectorAll(
|
|
143
|
-
'span[class
|
|
143
|
+
'span[class*="-calendarDay__day"]'
|
|
144
144
|
)
|
|
145
145
|
|
|
146
146
|
expect(calendarDays.length).toEqual(Calendar.DAY_COUNT)
|
|
@@ -272,11 +272,7 @@ describe('<Calendar />', () => {
|
|
|
272
272
|
|
|
273
273
|
it('should render next and prev buttons', async () => {
|
|
274
274
|
const { rerender } = render(
|
|
275
|
-
<Calendar
|
|
276
|
-
renderWeekdayLabels={weekdayLabels}
|
|
277
|
-
>
|
|
278
|
-
{generateDays()}
|
|
279
|
-
</Calendar>
|
|
275
|
+
<Calendar renderWeekdayLabels={weekdayLabels}>{generateDays()}</Calendar>
|
|
280
276
|
)
|
|
281
277
|
const defaultPrevButton = screen.getByText('Previous month')
|
|
282
278
|
const defaultNextButton = screen.getByText('Next month')
|
|
@@ -380,7 +376,7 @@ describe('<Calendar />', () => {
|
|
|
380
376
|
|
|
381
377
|
days.forEach((dayTd, i) => {
|
|
382
378
|
const index = i % 7
|
|
383
|
-
const day = dayTd.querySelector('span[class
|
|
379
|
+
const day = dayTd.querySelector('span[class*="-calendarDay"]')
|
|
384
380
|
|
|
385
381
|
expect(day).toHaveAttribute(
|
|
386
382
|
'aria-describedby',
|
package/src/Calendar/index.tsx
CHANGED
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
import React, { Children, Component, ReactElement, MouseEvent } from 'react'
|
|
25
|
+
import { Children, Component, ReactElement, MouseEvent } from 'react'
|
|
27
26
|
|
|
28
27
|
import { View } from '@instructure/ui-view'
|
|
29
28
|
import {
|
|
@@ -38,7 +37,7 @@ import { AccessibleContent } from '@instructure/ui-a11y-content'
|
|
|
38
37
|
|
|
39
38
|
import { testable } from '@instructure/ui-testable'
|
|
40
39
|
|
|
41
|
-
import { withStyle
|
|
40
|
+
import { withStyle } from '@instructure/emotion'
|
|
42
41
|
|
|
43
42
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n'
|
|
44
43
|
import type { Moment } from '@instructure/ui-i18n'
|
|
@@ -502,7 +501,6 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
502
501
|
|
|
503
502
|
const arr: Moment[] = []
|
|
504
503
|
for (let i = 0; i < Calendar.DAY_COUNT; i++) {
|
|
505
|
-
|
|
506
504
|
// This workaround is needed because moment's `.add({days: 1})` function has a bug that happens when the date added lands perfectly onto the DST cutoff,
|
|
507
505
|
// in these cases adding 1 day results in 23 hours added instead,
|
|
508
506
|
// so `moment.tz('2024-09-07T00:00:00', 'America/Santiago').add({days: 1})` results
|
|
@@ -512,12 +510,12 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
512
510
|
// Please note that this causes one hour of time difference in the affected timezones/dates and to
|
|
513
511
|
// fully solve this bug we need to change to something like luxon which handles this properly
|
|
514
512
|
if (currDate.clone().format('HH') === '23') {
|
|
515
|
-
arr.push(currDate.clone().add({hours: 1}))
|
|
513
|
+
arr.push(currDate.clone().add({ hours: 1 }))
|
|
516
514
|
} else {
|
|
517
515
|
arr.push(currDate.clone())
|
|
518
516
|
}
|
|
519
517
|
|
|
520
|
-
currDate.add({days: 1})
|
|
518
|
+
currDate.add({ days: 1 })
|
|
521
519
|
}
|
|
522
520
|
return arr.map((date) => {
|
|
523
521
|
const dateStr = date.toISOString()
|
package/src/Calendar/props.ts
CHANGED
|
@@ -34,7 +34,7 @@ import type {
|
|
|
34
34
|
OtherHTMLAttributes
|
|
35
35
|
} from '@instructure/shared-types'
|
|
36
36
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
37
|
-
import
|
|
37
|
+
import { ReactElement } from 'react'
|
|
38
38
|
import type { CalendarDayProps } from './Day/props'
|
|
39
39
|
import { Renderable } from '@instructure/shared-types'
|
|
40
40
|
import type { Moment } from '@instructure/ui-i18n'
|