@instructure/ui-calendar 11.7.3 → 11.7.4-pr-snapshot-1781695314229
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 +11 -0
- package/LICENSE.md +1 -0
- package/{lib/Calendar/v1/Day/props.js → babel.config.cjs} +12 -7
- package/es/Calendar/v1/Day/index.js +4 -4
- package/es/Calendar/v1/index.js +25 -10
- package/es/Calendar/v2/Day/index.js +3 -3
- package/es/Calendar/v2/index.js +28 -12
- package/es/Calendar/v2/styles.js +9 -0
- package/es/exports/a.js +2 -2
- package/es/exports/b.js +2 -2
- package/package.json +18 -23
- package/src/Calendar/v1/Day/index.tsx +4 -3
- package/src/Calendar/v1/index.tsx +24 -10
- package/src/Calendar/v1/props.ts +17 -13
- package/src/Calendar/v2/Day/index.tsx +3 -2
- package/src/Calendar/v2/README.md +18 -18
- package/src/Calendar/v2/index.tsx +30 -12
- package/src/Calendar/v2/props.ts +19 -11
- package/src/Calendar/v2/styles.ts +9 -0
- package/src/exports/a.ts +2 -2
- package/src/exports/b.ts +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Calendar/v1/Day/index.d.ts +1 -0
- package/types/Calendar/v1/Day/index.d.ts.map +1 -1
- package/types/Calendar/v1/index.d.ts +9 -4
- package/types/Calendar/v1/index.d.ts.map +1 -1
- package/types/Calendar/v1/props.d.ts +21 -13
- package/types/Calendar/v1/props.d.ts.map +1 -1
- package/types/Calendar/v2/Day/index.d.ts +1 -0
- package/types/Calendar/v2/Day/index.d.ts.map +1 -1
- package/types/Calendar/v2/index.d.ts +9 -4
- package/types/Calendar/v2/index.d.ts.map +1 -1
- package/types/Calendar/v2/props.d.ts +22 -14
- package/types/Calendar/v2/props.d.ts.map +1 -1
- package/types/Calendar/v2/styles.d.ts.map +1 -1
- package/types/exports/a.d.ts +2 -2
- package/types/exports/a.d.ts.map +1 -1
- package/types/exports/b.d.ts +2 -2
- package/types/exports/b.d.ts.map +1 -1
- package/lib/Calendar/v1/Day/index.js +0 -167
- package/lib/Calendar/v1/Day/styles.js +0 -88
- package/lib/Calendar/v1/Day/theme.js +0 -71
- package/lib/Calendar/v1/index.js +0 -456
- package/lib/Calendar/v1/props.js +0 -31
- package/lib/Calendar/v1/styles.js +0 -73
- package/lib/Calendar/v1/theme.js +0 -64
- package/lib/Calendar/v2/Day/index.js +0 -166
- package/lib/Calendar/v2/Day/props.js +0 -31
- package/lib/Calendar/v2/Day/styles.js +0 -88
- package/lib/Calendar/v2/index.js +0 -466
- package/lib/Calendar/v2/props.js +0 -31
- package/lib/Calendar/v2/styles.js +0 -74
- package/lib/exports/a.js +0 -19
- package/lib/exports/b.js +0 -19
- package/lib/package.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.4-pr-snapshot-1781695314229](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-pr-snapshot-1781695314229) (2026-06-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-dialog,ui-date-input,ui-calendar:** add aria-live to calendar header, descriptive nav button labels with target month, aria-modal on focused dialogs ([ac11880](https://github.com/instructure/instructure-ui/commit/ac11880013be74f148558671177ed25c9286204f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [11.7.3](https://github.com/instructure/instructure-ui/compare/v11.7.2...v11.7.3) (2026-05-07)
|
|
7
18
|
|
|
8
19
|
|
package/LICENSE.md
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
1
|
/*
|
|
8
2
|
* The MIT License (MIT)
|
|
9
3
|
*
|
|
@@ -28,4 +22,15 @@ exports.allowedProps = void 0;
|
|
|
28
22
|
* SOFTWARE.
|
|
29
23
|
*/
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
module.exports = {
|
|
26
|
+
presets: [
|
|
27
|
+
[
|
|
28
|
+
require('@instructure/ui-babel-preset'),
|
|
29
|
+
{
|
|
30
|
+
esModules: Boolean(process.env.ES_MODULES),
|
|
31
|
+
removeConsole: process.env.NODE_ENV === 'production',
|
|
32
|
+
transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -28,9 +28,9 @@ import { View } from '@instructure/ui-view/v11_6';
|
|
|
28
28
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
29
29
|
import { omitProps, callRenderProp, getElementType } from '@instructure/ui-react-utils';
|
|
30
30
|
import { withStyle } from '@instructure/emotion';
|
|
31
|
-
import generateStyle from
|
|
32
|
-
import generateComponentTheme from
|
|
33
|
-
import { allowedProps } from
|
|
31
|
+
import generateStyle from './styles.js';
|
|
32
|
+
import generateComponentTheme from './theme.js';
|
|
33
|
+
import { allowedProps } from './props.js';
|
|
34
34
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
35
35
|
/**
|
|
36
36
|
---
|
|
@@ -39,7 +39,7 @@ id: Calendar.Day
|
|
|
39
39
|
---
|
|
40
40
|
**/
|
|
41
41
|
let Day = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Day extends Component {
|
|
42
|
-
static displayName =
|
|
42
|
+
static displayName = 'Day';
|
|
43
43
|
static componentId = 'Calendar.Day';
|
|
44
44
|
static allowedProps = allowedProps;
|
|
45
45
|
static defaultProps = {
|
package/es/Calendar/v1/index.js
CHANGED
|
@@ -31,10 +31,10 @@ import { logError as error } from '@instructure/console';
|
|
|
31
31
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
32
32
|
import { withStyle } from '@instructure/emotion';
|
|
33
33
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n';
|
|
34
|
-
import generateStyle from
|
|
35
|
-
import generateComponentTheme from
|
|
36
|
-
import { Day } from
|
|
37
|
-
import { allowedProps } from
|
|
34
|
+
import generateStyle from './styles.js';
|
|
35
|
+
import generateComponentTheme from './theme.js';
|
|
36
|
+
import { Day } from './Day/index.js';
|
|
37
|
+
import { allowedProps } from './props.js';
|
|
38
38
|
import { IconButton } from '@instructure/ui-buttons/v11_6';
|
|
39
39
|
import { IconArrowOpenStartSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
|
|
40
40
|
import { SimpleSelect } from '@instructure/ui-simple-select/v11_6';
|
|
@@ -46,7 +46,7 @@ category: components
|
|
|
46
46
|
**/
|
|
47
47
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
48
48
|
let Calendar = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = class Calendar extends Component {
|
|
49
|
-
static displayName =
|
|
49
|
+
static displayName = 'Calendar';
|
|
50
50
|
static componentId = 'Calendar';
|
|
51
51
|
static contextType = ApplyLocaleContext;
|
|
52
52
|
static Day = Day;
|
|
@@ -115,24 +115,37 @@ let Calendar = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
115
115
|
renderNextMonthButton,
|
|
116
116
|
renderPrevMonthButton
|
|
117
117
|
} = this.props;
|
|
118
|
+
const {
|
|
119
|
+
visibleMonth
|
|
120
|
+
} = this.state;
|
|
121
|
+
const prevMonthName = visibleMonth.clone().subtract({
|
|
122
|
+
months: 1
|
|
123
|
+
}).format('MMMM YYYY');
|
|
124
|
+
const nextMonthName = visibleMonth.clone().add({
|
|
125
|
+
months: 1
|
|
126
|
+
}).format('MMMM YYYY');
|
|
118
127
|
return {
|
|
119
|
-
prevButton: renderPrevMonthButton ? callRenderProp(renderPrevMonthButton
|
|
128
|
+
prevButton: renderPrevMonthButton ? callRenderProp(renderPrevMonthButton, {
|
|
129
|
+
targetMonthSrLabel: prevMonthName
|
|
130
|
+
}) : _jsx(IconButton, {
|
|
120
131
|
size: "small",
|
|
121
132
|
withBackground: false,
|
|
122
133
|
withBorder: false,
|
|
123
134
|
renderIcon: _jsx(IconArrowOpenStartSolid, {
|
|
124
135
|
color: "primary"
|
|
125
136
|
}),
|
|
126
|
-
screenReaderLabel:
|
|
137
|
+
screenReaderLabel: `Previous month, ${prevMonthName}`
|
|
127
138
|
}),
|
|
128
|
-
nextButton: renderNextMonthButton ? callRenderProp(renderNextMonthButton
|
|
139
|
+
nextButton: renderNextMonthButton ? callRenderProp(renderNextMonthButton, {
|
|
140
|
+
targetMonthSrLabel: nextMonthName
|
|
141
|
+
}) : _jsx(IconButton, {
|
|
129
142
|
size: "small",
|
|
130
143
|
withBackground: false,
|
|
131
144
|
withBorder: false,
|
|
132
145
|
renderIcon: _jsx(IconArrowOpenEndSolid, {
|
|
133
146
|
color: "primary"
|
|
134
147
|
}),
|
|
135
|
-
screenReaderLabel:
|
|
148
|
+
screenReaderLabel: `Next month, ${nextMonthName}`
|
|
136
149
|
})
|
|
137
150
|
};
|
|
138
151
|
};
|
|
@@ -225,7 +238,9 @@ let Calendar = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
225
238
|
return _jsxs("div", {
|
|
226
239
|
children: [_jsxs("div", {
|
|
227
240
|
css: style,
|
|
228
|
-
children: [prevButton && cloneButton(prevButton, this.handleMonthChange('prev')), renderNavigationLabel ? callRenderProp(renderNavigationLabel) : _jsxs("
|
|
241
|
+
children: [prevButton && cloneButton(prevButton, this.handleMonthChange('prev')), renderNavigationLabel ? callRenderProp(renderNavigationLabel) : _jsxs("div", {
|
|
242
|
+
"aria-live": "polite",
|
|
243
|
+
"aria-atomic": "true",
|
|
229
244
|
children: [_jsx("div", {
|
|
230
245
|
children: visibleMonth.format('MMMM')
|
|
231
246
|
}), !withYearPicker ? _jsx("div", {
|
|
@@ -28,8 +28,8 @@ import { View } from '@instructure/ui-view/latest';
|
|
|
28
28
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
29
29
|
import { omitProps, callRenderProp, getElementType } from '@instructure/ui-react-utils';
|
|
30
30
|
import { withStyleNew } from '@instructure/emotion';
|
|
31
|
-
import generateStyle from
|
|
32
|
-
import { allowedProps } from
|
|
31
|
+
import generateStyle from './styles.js';
|
|
32
|
+
import { allowedProps } from './props.js';
|
|
33
33
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
34
34
|
/**
|
|
35
35
|
---
|
|
@@ -38,7 +38,7 @@ id: Calendar.Day
|
|
|
38
38
|
---
|
|
39
39
|
**/
|
|
40
40
|
let Day = (_dec = withStyleNew(generateStyle), _dec(_class = class Day extends Component {
|
|
41
|
-
static displayName =
|
|
41
|
+
static displayName = 'Day';
|
|
42
42
|
static componentId = 'Calendar.Day';
|
|
43
43
|
static allowedProps = allowedProps;
|
|
44
44
|
static defaultProps = {
|
package/es/Calendar/v2/index.js
CHANGED
|
@@ -31,9 +31,9 @@ import { logError as error } from '@instructure/console';
|
|
|
31
31
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
32
32
|
import { withStyleNew } from '@instructure/emotion';
|
|
33
33
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n';
|
|
34
|
-
import generateStyle from
|
|
35
|
-
import { Day } from
|
|
36
|
-
import { allowedProps } from
|
|
34
|
+
import generateStyle from './styles.js';
|
|
35
|
+
import { Day } from './Day/index.js';
|
|
36
|
+
import { allowedProps } from './props.js';
|
|
37
37
|
import { IconButton } from '@instructure/ui-buttons/latest';
|
|
38
38
|
import { ChevronLeftInstUIIcon, ChevronRightInstUIIcon } from '@instructure/ui-icons';
|
|
39
39
|
import { SimpleSelect } from '@instructure/ui-simple-select/latest';
|
|
@@ -45,7 +45,7 @@ category: components
|
|
|
45
45
|
**/
|
|
46
46
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
47
47
|
let Calendar = (_dec = withDeterministicId(), _dec2 = withStyleNew(generateStyle), _dec(_class = _dec2(_class = class Calendar extends Component {
|
|
48
|
-
static displayName =
|
|
48
|
+
static displayName = 'Calendar';
|
|
49
49
|
static componentId = 'Calendar';
|
|
50
50
|
static contextType = ApplyLocaleContext;
|
|
51
51
|
static Day = Day;
|
|
@@ -114,24 +114,37 @@ let Calendar = (_dec = withDeterministicId(), _dec2 = withStyleNew(generateStyle
|
|
|
114
114
|
renderNextMonthButton,
|
|
115
115
|
renderPrevMonthButton
|
|
116
116
|
} = this.props;
|
|
117
|
+
const {
|
|
118
|
+
visibleMonth
|
|
119
|
+
} = this.state;
|
|
120
|
+
const prevMonthName = visibleMonth.clone().subtract({
|
|
121
|
+
months: 1
|
|
122
|
+
}).format('MMMM YYYY');
|
|
123
|
+
const nextMonthName = visibleMonth.clone().add({
|
|
124
|
+
months: 1
|
|
125
|
+
}).format('MMMM YYYY');
|
|
117
126
|
return {
|
|
118
|
-
prevButton: renderPrevMonthButton ? callRenderProp(renderPrevMonthButton
|
|
127
|
+
prevButton: renderPrevMonthButton ? callRenderProp(renderPrevMonthButton, {
|
|
128
|
+
targetMonthSrLabel: prevMonthName
|
|
129
|
+
}) : _jsx(IconButton, {
|
|
119
130
|
size: "small",
|
|
120
131
|
withBackground: false,
|
|
121
132
|
withBorder: false,
|
|
122
133
|
renderIcon: _jsx(ChevronLeftInstUIIcon, {
|
|
123
134
|
color: "baseColor"
|
|
124
135
|
}),
|
|
125
|
-
screenReaderLabel:
|
|
136
|
+
screenReaderLabel: `Previous month, ${prevMonthName}`
|
|
126
137
|
}),
|
|
127
|
-
nextButton: renderNextMonthButton ? callRenderProp(renderNextMonthButton
|
|
138
|
+
nextButton: renderNextMonthButton ? callRenderProp(renderNextMonthButton, {
|
|
139
|
+
targetMonthSrLabel: nextMonthName
|
|
140
|
+
}) : _jsx(IconButton, {
|
|
128
141
|
size: "small",
|
|
129
142
|
withBackground: false,
|
|
130
143
|
withBorder: false,
|
|
131
144
|
renderIcon: _jsx(ChevronRightInstUIIcon, {
|
|
132
145
|
color: "baseColor"
|
|
133
146
|
}),
|
|
134
|
-
screenReaderLabel:
|
|
147
|
+
screenReaderLabel: `Next month, ${nextMonthName}`
|
|
135
148
|
})
|
|
136
149
|
};
|
|
137
150
|
};
|
|
@@ -224,17 +237,20 @@ let Calendar = (_dec = withDeterministicId(), _dec2 = withStyleNew(generateStyle
|
|
|
224
237
|
return _jsxs("div", {
|
|
225
238
|
children: [_jsxs("div", {
|
|
226
239
|
css: style,
|
|
227
|
-
children: [prevButton && cloneButton(prevButton, this.handleMonthChange('prev')), renderNavigationLabel ? callRenderProp(renderNavigationLabel) : _jsxs("
|
|
228
|
-
|
|
240
|
+
children: [prevButton && cloneButton(prevButton, this.handleMonthChange('prev')), renderNavigationLabel ? callRenderProp(renderNavigationLabel) : _jsxs("h2", {
|
|
241
|
+
"aria-live": "polite",
|
|
242
|
+
"aria-atomic": "true",
|
|
243
|
+
css: styles?.navigationLabel,
|
|
244
|
+
children: [_jsx("span", {
|
|
229
245
|
children: visibleMonth.format('MMMM')
|
|
230
|
-
}), !withYearPicker ? _jsx("
|
|
246
|
+
}), !withYearPicker ? _jsx("span", {
|
|
231
247
|
children: visibleMonth.format('YYYY')
|
|
232
248
|
}) : null]
|
|
233
249
|
}), nextButton && cloneButton(nextButton, this.handleMonthChange('next'))]
|
|
234
250
|
}), withYearPicker ? _jsx("div", {
|
|
235
251
|
css: styles?.yearPicker,
|
|
236
252
|
children: _jsx(SimpleSelect, {
|
|
237
|
-
width: "
|
|
253
|
+
width: "95px",
|
|
238
254
|
renderLabel: "",
|
|
239
255
|
placeholder: "--",
|
|
240
256
|
assistiveText: withYearPicker.screenReaderLabel,
|
package/es/Calendar/v2/styles.js
CHANGED
|
@@ -57,6 +57,15 @@ const generateStyle = (componentTheme, props) => {
|
|
|
57
57
|
maxWidth: componentTheme.maxHeaderWidth,
|
|
58
58
|
lineHeight: componentTheme.lineHeight
|
|
59
59
|
},
|
|
60
|
+
navigationLabel: {
|
|
61
|
+
label: 'calendar__navigation-label',
|
|
62
|
+
margin: 0,
|
|
63
|
+
fontSize: 'inherit',
|
|
64
|
+
fontWeight: 'inherit',
|
|
65
|
+
'& span': {
|
|
66
|
+
display: 'block'
|
|
67
|
+
}
|
|
68
|
+
},
|
|
60
69
|
yearPicker: {
|
|
61
70
|
display: 'flex',
|
|
62
71
|
justifyContent: 'center',
|
package/es/exports/a.js
CHANGED
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
export { Calendar } from
|
|
25
|
-
export { Day as CalendarDay } from
|
|
24
|
+
export { Calendar } from '../Calendar/v1/index.js';
|
|
25
|
+
export { Day as CalendarDay } from '../Calendar/v1/Day/index.js';
|
package/es/exports/b.js
CHANGED
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
|
-
export { Calendar } from
|
|
25
|
-
export { Day as CalendarDay } from
|
|
24
|
+
export { Calendar } from '../Calendar/v2/index.js';
|
|
25
|
+
export { Day as CalendarDay } from '../Calendar/v2/Day/index.js';
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-calendar",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.4-pr-snapshot-1781695314229",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "A calendar component.",
|
|
5
6
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
7
|
"module": "./es/index.js",
|
|
7
|
-
"main": "./lib/index.js",
|
|
8
8
|
"types": "./types/index.d.ts",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -15,27 +15,27 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.2",
|
|
18
|
-
"@instructure/
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/ui-buttons": "11.7.
|
|
22
|
-
"@instructure/
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/
|
|
30
|
-
"@instructure/
|
|
18
|
+
"@instructure/console": "11.7.4-pr-snapshot-1781695314229",
|
|
19
|
+
"@instructure/emotion": "11.7.4-pr-snapshot-1781695314229",
|
|
20
|
+
"@instructure/ui-a11y-content": "11.7.4-pr-snapshot-1781695314229",
|
|
21
|
+
"@instructure/ui-buttons": "11.7.4-pr-snapshot-1781695314229",
|
|
22
|
+
"@instructure/shared-types": "11.7.4-pr-snapshot-1781695314229",
|
|
23
|
+
"@instructure/ui-i18n": "11.7.4-pr-snapshot-1781695314229",
|
|
24
|
+
"@instructure/ui-react-utils": "11.7.4-pr-snapshot-1781695314229",
|
|
25
|
+
"@instructure/ui-icons": "11.7.4-pr-snapshot-1781695314229",
|
|
26
|
+
"@instructure/ui-simple-select": "11.7.4-pr-snapshot-1781695314229",
|
|
27
|
+
"@instructure/ui-themes": "11.7.4-pr-snapshot-1781695314229",
|
|
28
|
+
"@instructure/ui-utils": "11.7.4-pr-snapshot-1781695314229",
|
|
29
|
+
"@instructure/ui-view": "11.7.4-pr-snapshot-1781695314229",
|
|
30
|
+
"@instructure/uid": "11.7.4-pr-snapshot-1781695314229"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@testing-library/jest-dom": "^6.6.3",
|
|
34
34
|
"@testing-library/react": "15.0.7",
|
|
35
35
|
"@testing-library/user-event": "^14.6.1",
|
|
36
36
|
"vitest": "^3.2.2",
|
|
37
|
-
"@instructure/ui-babel-preset": "11.7.
|
|
38
|
-
"@instructure/ui-color-utils": "11.7.
|
|
37
|
+
"@instructure/ui-babel-preset": "11.7.4-pr-snapshot-1781695314229",
|
|
38
|
+
"@instructure/ui-color-utils": "11.7.4-pr-snapshot-1781695314229"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=18 <=19"
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"sideEffects": false,
|
|
47
47
|
"exports": {
|
|
48
|
-
"./lib/*": "./lib/*",
|
|
49
48
|
"./es/*": "./es/*",
|
|
50
49
|
"./types/*": "./types/*",
|
|
51
50
|
"./package.json": "./package.json",
|
|
@@ -54,28 +53,24 @@
|
|
|
54
53
|
"src": "./src/exports/a.ts",
|
|
55
54
|
"types": "./types/exports/a.d.ts",
|
|
56
55
|
"import": "./es/exports/a.js",
|
|
57
|
-
"require": "./lib/exports/a.js",
|
|
58
56
|
"default": "./es/exports/a.js"
|
|
59
57
|
},
|
|
60
58
|
"./v11_6": {
|
|
61
59
|
"src": "./src/exports/a.ts",
|
|
62
60
|
"types": "./types/exports/a.d.ts",
|
|
63
61
|
"import": "./es/exports/a.js",
|
|
64
|
-
"require": "./lib/exports/a.js",
|
|
65
62
|
"default": "./es/exports/a.js"
|
|
66
63
|
},
|
|
67
64
|
"./v11_7": {
|
|
68
65
|
"src": "./src/exports/b.ts",
|
|
69
66
|
"types": "./types/exports/b.d.ts",
|
|
70
67
|
"import": "./es/exports/b.js",
|
|
71
|
-
"require": "./lib/exports/b.js",
|
|
72
68
|
"default": "./es/exports/b.js"
|
|
73
69
|
},
|
|
74
70
|
"./latest": {
|
|
75
71
|
"src": "./src/exports/b.ts",
|
|
76
72
|
"types": "./types/exports/b.d.ts",
|
|
77
73
|
"import": "./es/exports/b.js",
|
|
78
|
-
"require": "./lib/exports/b.js",
|
|
79
74
|
"default": "./es/exports/b.js"
|
|
80
75
|
}
|
|
81
76
|
},
|
|
@@ -83,7 +78,7 @@
|
|
|
83
78
|
"lint": "ui-scripts lint",
|
|
84
79
|
"lint:fix": "ui-scripts lint --fix",
|
|
85
80
|
"clean": "ui-scripts clean",
|
|
86
|
-
"build": "ui-scripts build
|
|
81
|
+
"build": "ui-scripts build",
|
|
87
82
|
"build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
|
|
88
83
|
"build:types": "tsc -p tsconfig.build.json",
|
|
89
84
|
"ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
|
|
36
36
|
import { withStyle } from '@instructure/emotion'
|
|
37
37
|
|
|
38
|
-
import generateStyle from './styles'
|
|
39
|
-
import generateComponentTheme from './theme'
|
|
38
|
+
import generateStyle from './styles.js'
|
|
39
|
+
import generateComponentTheme from './theme.js'
|
|
40
40
|
|
|
41
|
-
import { allowedProps } from './props'
|
|
41
|
+
import { allowedProps } from './props.js'
|
|
42
42
|
import type { CalendarDayProps, CalendarDayStyleProps } from './props'
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -49,6 +49,7 @@ id: Calendar.Day
|
|
|
49
49
|
**/
|
|
50
50
|
@withStyle(generateStyle, generateComponentTheme)
|
|
51
51
|
class Day extends Component<CalendarDayProps> {
|
|
52
|
+
static displayName = 'Day'
|
|
52
53
|
static readonly componentId = 'Calendar.Day'
|
|
53
54
|
|
|
54
55
|
static allowedProps = allowedProps
|
|
@@ -40,12 +40,12 @@ import { withStyle } from '@instructure/emotion'
|
|
|
40
40
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n'
|
|
41
41
|
import type { Moment } from '@instructure/ui-i18n'
|
|
42
42
|
|
|
43
|
-
import generateStyle from './styles'
|
|
44
|
-
import generateComponentTheme from './theme'
|
|
43
|
+
import generateStyle from './styles.js'
|
|
44
|
+
import generateComponentTheme from './theme.js'
|
|
45
45
|
|
|
46
|
-
import { Day } from './Day'
|
|
46
|
+
import { Day } from './Day/index.js'
|
|
47
47
|
|
|
48
|
-
import { allowedProps } from './props'
|
|
48
|
+
import { allowedProps } from './props.js'
|
|
49
49
|
import type { CalendarProps, CalendarState } from './props'
|
|
50
50
|
import { Renderable } from '@instructure/shared-types'
|
|
51
51
|
|
|
@@ -65,6 +65,7 @@ category: components
|
|
|
65
65
|
@withDeterministicId()
|
|
66
66
|
@withStyle(generateStyle, generateComponentTheme)
|
|
67
67
|
class Calendar extends Component<CalendarProps, CalendarState> {
|
|
68
|
+
static displayName = 'Calendar'
|
|
68
69
|
static readonly componentId = 'Calendar'
|
|
69
70
|
|
|
70
71
|
declare context: React.ContextType<typeof ApplyLocaleContext>
|
|
@@ -175,28 +176,41 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
175
176
|
|
|
176
177
|
renderMonthNavigationButtons = () => {
|
|
177
178
|
const { renderNextMonthButton, renderPrevMonthButton } = this.props
|
|
179
|
+
const { visibleMonth } = this.state
|
|
180
|
+
const prevMonthName = visibleMonth
|
|
181
|
+
.clone()
|
|
182
|
+
.subtract({ months: 1 })
|
|
183
|
+
.format('MMMM YYYY')
|
|
184
|
+
const nextMonthName = visibleMonth
|
|
185
|
+
.clone()
|
|
186
|
+
.add({ months: 1 })
|
|
187
|
+
.format('MMMM YYYY')
|
|
178
188
|
|
|
179
189
|
return {
|
|
180
190
|
prevButton: renderPrevMonthButton ? (
|
|
181
|
-
callRenderProp(renderPrevMonthButton
|
|
191
|
+
callRenderProp(renderPrevMonthButton, {
|
|
192
|
+
targetMonthSrLabel: prevMonthName
|
|
193
|
+
})
|
|
182
194
|
) : (
|
|
183
195
|
<IconButton
|
|
184
196
|
size="small"
|
|
185
197
|
withBackground={false}
|
|
186
198
|
withBorder={false}
|
|
187
199
|
renderIcon={<IconArrowOpenStartSolid color="primary" />}
|
|
188
|
-
screenReaderLabel=
|
|
200
|
+
screenReaderLabel={`Previous month, ${prevMonthName}`}
|
|
189
201
|
/>
|
|
190
202
|
),
|
|
191
203
|
nextButton: renderNextMonthButton ? (
|
|
192
|
-
callRenderProp(renderNextMonthButton
|
|
204
|
+
callRenderProp(renderNextMonthButton, {
|
|
205
|
+
targetMonthSrLabel: nextMonthName
|
|
206
|
+
})
|
|
193
207
|
) : (
|
|
194
208
|
<IconButton
|
|
195
209
|
size="small"
|
|
196
210
|
withBackground={false}
|
|
197
211
|
withBorder={false}
|
|
198
212
|
renderIcon={<IconArrowOpenEndSolid color="primary" />}
|
|
199
|
-
screenReaderLabel=
|
|
213
|
+
screenReaderLabel={`Next month, ${nextMonthName}`}
|
|
200
214
|
/>
|
|
201
215
|
)
|
|
202
216
|
}
|
|
@@ -299,12 +313,12 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
299
313
|
{renderNavigationLabel ? (
|
|
300
314
|
callRenderProp(renderNavigationLabel)
|
|
301
315
|
) : (
|
|
302
|
-
<
|
|
316
|
+
<div aria-live="polite" aria-atomic="true">
|
|
303
317
|
<div>{visibleMonth.format('MMMM')}</div>
|
|
304
318
|
{!withYearPicker ? (
|
|
305
319
|
<div>{visibleMonth.format('YYYY')}</div>
|
|
306
320
|
) : null}
|
|
307
|
-
</
|
|
321
|
+
</div>
|
|
308
322
|
)}
|
|
309
323
|
{nextButton &&
|
|
310
324
|
cloneButton(nextButton, this.handleMonthChange('next'))}
|
package/src/Calendar/v1/props.ts
CHANGED
|
@@ -98,19 +98,23 @@ type CalendarOwnProps = {
|
|
|
98
98
|
*/
|
|
99
99
|
renderNavigationLabel?: Renderable
|
|
100
100
|
/**
|
|
101
|
-
* A button to render in the navigation header.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
*
|
|
111
|
-
* `
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
* A button to render in the navigation header.
|
|
102
|
+
* When passed as a function, receives `{ targetMonthSrLabel }` —
|
|
103
|
+
* a pre-formatted screen reader label for the target month (e.g. "November 2023").
|
|
104
|
+
* The recommendation is to compose it with the [IconButton](Button) component
|
|
105
|
+
* by setting the `size` prop to `small`, `withBorder` and `withBackground` to `false`,
|
|
106
|
+
* and setting `renderIcon` to [IconArrowOpenStart](icons).
|
|
107
|
+
*/
|
|
108
|
+
renderNextMonthButton?: Renderable<{ targetMonthSrLabel: string }>
|
|
109
|
+
/**
|
|
110
|
+
* A button to render in the navigation header.
|
|
111
|
+
* When passed as a function, receives `{ targetMonthSrLabel }` —
|
|
112
|
+
* a pre-formatted screen reader label for the target month (e.g. "November 2023").
|
|
113
|
+
* The recommendation is to compose it with the [IconButton](Button) component
|
|
114
|
+
* by setting the `size` prop to `small`, `withBorder` and `withBackground` to `false`,
|
|
115
|
+
* and setting `renderIcon` to [IconArrowOpenStart](icons).
|
|
116
|
+
*/
|
|
117
|
+
renderPrevMonthButton?: Renderable<{ targetMonthSrLabel: string }>
|
|
114
118
|
/**
|
|
115
119
|
* An array of labels containing the name of each day of the week. The visible
|
|
116
120
|
* portion of the label should be abbreviated (no longer than three characters).
|
|
@@ -35,9 +35,9 @@ import {
|
|
|
35
35
|
|
|
36
36
|
import { withStyleNew } from '@instructure/emotion'
|
|
37
37
|
|
|
38
|
-
import generateStyle from './styles'
|
|
38
|
+
import generateStyle from './styles.js'
|
|
39
39
|
|
|
40
|
-
import { allowedProps } from './props'
|
|
40
|
+
import { allowedProps } from './props.js'
|
|
41
41
|
import type { CalendarDayProps, CalendarDayStyleProps } from './props'
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -48,6 +48,7 @@ id: Calendar.Day
|
|
|
48
48
|
**/
|
|
49
49
|
@withStyleNew(generateStyle)
|
|
50
50
|
class Day extends Component<CalendarDayProps> {
|
|
51
|
+
static displayName = 'Day'
|
|
51
52
|
static readonly componentId = 'Calendar.Day'
|
|
52
53
|
|
|
53
54
|
static allowedProps = allowedProps
|
|
@@ -174,23 +174,26 @@ type: example
|
|
|
174
174
|
|
|
175
175
|
const date = parseDate(renderedDate)
|
|
176
176
|
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
177
|
+
const renderMonthButton = (type = 'prev') => ({ targetMonthSrLabel }) => (
|
|
178
|
+
<IconButton
|
|
179
|
+
size="small"
|
|
180
|
+
withBackground={false}
|
|
181
|
+
withBorder={false}
|
|
182
|
+
renderIcon={
|
|
183
|
+
type === 'prev' ? (
|
|
184
|
+
<ChevronLeftInstUIIcon color="baseColor" />
|
|
185
|
+
) : (
|
|
186
|
+
<ChevronRightInstUIIcon color="baseColor" />
|
|
187
|
+
)
|
|
188
|
+
}
|
|
189
|
+
screenReaderLabel={`${type === 'prev' ? 'Previous month' : 'Next month'}, ${targetMonthSrLabel}`}
|
|
190
|
+
/>
|
|
191
|
+
)
|
|
189
192
|
|
|
190
193
|
return (
|
|
191
194
|
<Calendar
|
|
192
|
-
renderPrevMonthButton={
|
|
193
|
-
renderNextMonthButton={
|
|
195
|
+
renderPrevMonthButton={renderMonthButton('prev')}
|
|
196
|
+
renderNextMonthButton={renderMonthButton('next')}
|
|
194
197
|
renderNavigationLabel={
|
|
195
198
|
<span>
|
|
196
199
|
<div>{date.format('MMMM')}</div>
|
|
@@ -251,7 +254,4 @@ the abbreviation. ex. `[<AccessibleContent alt="Sunday">Sun</AccessibleContent>,
|
|
|
251
254
|
|
|
252
255
|
#### Rendering next and previous month buttons
|
|
253
256
|
|
|
254
|
-
The `renderNextMonthButton` and `renderPrevMonthButton` can be supplied
|
|
255
|
-
[IconButton](IconButton) component with the `size` prop set to
|
|
256
|
-
`small`, the `withBackground` and `withBorder` props both set to `false`, and the `renderIcon` prop set to `ChevronLeftInstUIIcon` or
|
|
257
|
-
`ChevronRightInstUIIcon`.
|
|
257
|
+
The `renderNextMonthButton` and `renderPrevMonthButton` can be supplied as a function that receives `{ targetMonthSrLabel }` — a pre-formatted screen reader label for the target month (e.g. "November 2023"). Use this to compose an [IconButton](IconButton) component with the `size` prop set to `small`, the `withBackground` and `withBorder` props both set to `false`, and the `renderIcon` prop set to `ChevronLeftInstUIIcon` or `ChevronRightInstUIIcon`. The `screenReaderLabel` should include the target month for better accessibility: e.g. "Previous month, November 2023".
|