@instructure/ui-calendar 10.26.1-snapshot-2 → 10.26.2
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 +5 -18
- package/es/Calendar/Day/index.js +6 -6
- package/es/Calendar/Day/props.js +16 -1
- package/es/Calendar/index.js +6 -6
- package/es/Calendar/props.js +23 -1
- package/lib/Calendar/Day/index.js +5 -5
- package/lib/Calendar/Day/props.js +17 -1
- package/lib/Calendar/index.js +5 -5
- package/lib/Calendar/props.js +24 -1
- package/package.json +21 -18
- package/src/Calendar/Day/index.tsx +5 -2
- package/src/Calendar/Day/props.ts +20 -1
- package/src/Calendar/index.tsx +7 -4
- package/src/Calendar/props.ts +30 -1
- package/tsconfig.build.json +2 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Calendar/Day/index.d.ts +18 -1
- package/types/Calendar/Day/index.d.ts.map +1 -1
- package/types/Calendar/Day/props.d.ts +3 -2
- package/types/Calendar/Day/props.d.ts.map +1 -1
- package/types/Calendar/index.d.ts +24 -0
- package/types/Calendar/index.d.ts.map +1 -1
- package/types/Calendar/props.d.ts +3 -2
- package/types/Calendar/props.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,30 +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
|
-
## [10.26.
|
|
6
|
+
## [10.26.2](https://github.com/instructure/instructure-ui/compare/v10.26.1...v10.26.2) (2025-10-13)
|
|
7
7
|
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-calendar
|
|
8
9
|
|
|
9
|
-
### Features
|
|
10
10
|
|
|
11
|
-
* **many:** instUI v11 release ([36f5438](https://github.com/instructure/instructure-ui/commit/36f54382669186227ba24798bbf7201ef2f5cd4c))
|
|
12
11
|
|
|
13
12
|
|
|
14
|
-
### BREAKING CHANGES
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- remove `CodeEditor` component
|
|
20
|
-
- remove `@instui/theme-registry` package
|
|
21
|
-
- remove `@testable`, `@experimental`, `@hack` decorators
|
|
22
|
-
- InstUISettingsProvider's `as` prop is removed
|
|
23
|
-
- `canvas.use()`, `canvasHighContrast.use()` functions are removed
|
|
24
|
-
- `canvasThemeLocal`, `canvasHighContrastThemeLocal` are removed
|
|
25
|
-
- `variables` field on theme objects are removed
|
|
26
|
-
- remove deprecated props from Table: Row's `isStacked`, Body's
|
|
27
|
-
`isStacked`, `hover`, and `headers`
|
|
28
|
-
- `Table`'s `caption` prop is now required
|
|
29
|
-
- `ui-dom-utils`'s `getComputedStyle` can now return `undefined`
|
|
14
|
+
## [10.26.1](https://github.com/instructure/instructure-ui/compare/v10.26.0...v10.26.1) (2025-10-06)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @instructure/ui-calendar
|
|
30
17
|
|
|
31
18
|
|
|
32
19
|
|
package/es/Calendar/Day/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
const _excluded = ["children", "label", "interaction", "isOutsideMonth", "isSelected", "isToday", "onClick", "onKeyDown", "as", "styles"];
|
|
3
|
-
var _dec, _class, _Day;
|
|
3
|
+
var _dec, _dec2, _class, _Day;
|
|
4
4
|
/*
|
|
5
5
|
* The MIT License (MIT)
|
|
6
6
|
*
|
|
@@ -29,10 +29,11 @@ import { Component } from 'react';
|
|
|
29
29
|
import { View } from '@instructure/ui-view';
|
|
30
30
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
31
31
|
import { omitProps, callRenderProp, getElementType } from '@instructure/ui-react-utils';
|
|
32
|
+
import { testable } from '@instructure/ui-testable';
|
|
32
33
|
import { withStyle } from '@instructure/emotion';
|
|
33
34
|
import generateStyle from './styles';
|
|
34
35
|
import generateComponentTheme from './theme';
|
|
35
|
-
import { allowedProps } from './props';
|
|
36
|
+
import { propTypes, allowedProps } from './props';
|
|
36
37
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
37
38
|
/**
|
|
38
39
|
---
|
|
@@ -40,7 +41,7 @@ parent: Calendar
|
|
|
40
41
|
id: Calendar.Day
|
|
41
42
|
---
|
|
42
43
|
**/
|
|
43
|
-
let Day = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_Day = class Day extends Component {
|
|
44
|
+
let Day = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_Day = class Day extends Component {
|
|
44
45
|
constructor(...args) {
|
|
45
46
|
super(...args);
|
|
46
47
|
this.ref = null;
|
|
@@ -129,7 +130,6 @@ let Day = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
129
130
|
onClick: onClick && this.handleClick,
|
|
130
131
|
onKeyDown: onKeyDown && this.handleKeyDown,
|
|
131
132
|
elementRef: this.handleElementRef,
|
|
132
|
-
"data-cid": "Calendar.Day",
|
|
133
133
|
children: _jsx("span", {
|
|
134
134
|
css: styles === null || styles === void 0 ? void 0 : styles.day,
|
|
135
135
|
children: _jsx(AccessibleContent, {
|
|
@@ -139,11 +139,11 @@ let Day = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class
|
|
|
139
139
|
})
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
}, _Day.displayName = "Day", _Day.componentId = 'Calendar.Day', _Day.allowedProps = allowedProps, _Day.defaultProps = {
|
|
142
|
+
}, _Day.displayName = "Day", _Day.componentId = 'Calendar.Day', _Day.propTypes = propTypes, _Day.allowedProps = allowedProps, _Day.defaultProps = {
|
|
143
143
|
interaction: 'enabled',
|
|
144
144
|
isSelected: false,
|
|
145
145
|
isToday: false,
|
|
146
146
|
isOutsideMonth: false
|
|
147
|
-
}, _Day)) || _class);
|
|
147
|
+
}, _Day)) || _class) || _class);
|
|
148
148
|
export default Day;
|
|
149
149
|
export { Day };
|
package/es/Calendar/Day/props.js
CHANGED
|
@@ -22,5 +22,20 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { I18nPropTypes } from '@instructure/ui-i18n';
|
|
27
|
+
const propTypes = {
|
|
28
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
29
|
+
date: I18nPropTypes.iso8601.isRequired,
|
|
30
|
+
label: PropTypes.string.isRequired,
|
|
31
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled']),
|
|
32
|
+
isSelected: PropTypes.bool,
|
|
33
|
+
isToday: PropTypes.bool,
|
|
34
|
+
isOutsideMonth: PropTypes.bool,
|
|
35
|
+
onClick: PropTypes.func,
|
|
36
|
+
onKeyDown: PropTypes.func,
|
|
37
|
+
elementRef: PropTypes.func,
|
|
38
|
+
as: PropTypes.elementType
|
|
39
|
+
};
|
|
25
40
|
const allowedProps = ['children', 'date', 'label', 'interaction', 'isSelected', 'isToday', 'isOutsideMonth', 'onClick', 'onKeyDown', 'elementRef', 'as'];
|
|
26
|
-
export { allowedProps };
|
|
41
|
+
export { propTypes, allowedProps };
|
package/es/Calendar/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _dec, _dec2, _class, _Calendar, _IconButton, _IconButton2;
|
|
1
|
+
var _dec, _dec2, _dec3, _class, _Calendar, _IconButton, _IconButton2;
|
|
2
2
|
/*
|
|
3
3
|
* The MIT License (MIT)
|
|
4
4
|
*
|
|
@@ -29,12 +29,13 @@ import { safeCloneElement, callRenderProp, omitProps, withDeterministicId } from
|
|
|
29
29
|
import { createChainedFunction } from '@instructure/ui-utils';
|
|
30
30
|
import { logError as error } from '@instructure/console';
|
|
31
31
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
32
|
+
import { testable } from '@instructure/ui-testable';
|
|
32
33
|
import { withStyle } from '@instructure/emotion';
|
|
33
34
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n';
|
|
34
35
|
import generateStyle from './styles';
|
|
35
36
|
import generateComponentTheme from './theme';
|
|
36
37
|
import { Day } from './Day';
|
|
37
|
-
import { allowedProps } from './props';
|
|
38
|
+
import { propTypes, allowedProps } from './props';
|
|
38
39
|
import { IconButton } from '@instructure/ui-buttons';
|
|
39
40
|
import { IconArrowOpenStartSolid, IconArrowOpenEndSolid } from '@instructure/ui-icons';
|
|
40
41
|
import { SimpleSelect } from '@instructure/ui-simple-select';
|
|
@@ -45,7 +46,7 @@ category: components
|
|
|
45
46
|
---
|
|
46
47
|
**/
|
|
47
48
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
48
|
-
let Calendar = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_Calendar = class Calendar extends Component {
|
|
49
|
+
let Calendar = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec3 = testable(), _dec(_class = _dec2(_class = _dec3(_class = (_Calendar = class Calendar extends Component {
|
|
49
50
|
constructor(props) {
|
|
50
51
|
super(props);
|
|
51
52
|
this.ref = null;
|
|
@@ -396,13 +397,12 @@ let Calendar = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, g
|
|
|
396
397
|
padding: "small",
|
|
397
398
|
background: "primary",
|
|
398
399
|
elementRef: this.handleRef,
|
|
399
|
-
"data-cid": "Calendar",
|
|
400
400
|
children: [this.renderHeader(), this.renderBody()]
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
|
-
}, _Calendar.displayName = "Calendar", _Calendar.componentId = 'Calendar', _Calendar.contextType = ApplyLocaleContext, _Calendar.Day = Day, _Calendar.DAY_COUNT = 42, _Calendar.allowedProps = allowedProps, _Calendar.defaultProps = {
|
|
403
|
+
}, _Calendar.displayName = "Calendar", _Calendar.componentId = 'Calendar', _Calendar.contextType = ApplyLocaleContext, _Calendar.Day = Day, _Calendar.DAY_COUNT = 42, _Calendar.propTypes = propTypes, _Calendar.allowedProps = allowedProps, _Calendar.defaultProps = {
|
|
404
404
|
as: 'span',
|
|
405
405
|
role: 'table'
|
|
406
|
-
}, _Calendar)) || _class) || _class);
|
|
406
|
+
}, _Calendar)) || _class) || _class) || _class);
|
|
407
407
|
export default Calendar;
|
|
408
408
|
export { Calendar };
|
package/es/Calendar/props.js
CHANGED
|
@@ -22,5 +22,27 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types';
|
|
26
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types';
|
|
27
|
+
import { Day } from './Day';
|
|
28
|
+
const propTypes = {
|
|
29
|
+
as: PropTypes.elementType,
|
|
30
|
+
children: ChildrenPropTypes.oneOf([Day]),
|
|
31
|
+
currentDate: PropTypes.string,
|
|
32
|
+
disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
|
|
33
|
+
locale: PropTypes.string,
|
|
34
|
+
onDateSelected: PropTypes.func,
|
|
35
|
+
onRequestRenderNextMonth: PropTypes.func,
|
|
36
|
+
onRequestRenderPrevMonth: PropTypes.func,
|
|
37
|
+
renderNavigationLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
38
|
+
renderNextMonthButton: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
39
|
+
renderPrevMonthButton: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
40
|
+
renderWeekdayLabels: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.node, PropTypes.func])),
|
|
41
|
+
role: PropTypes.oneOf(['table', 'listbox']),
|
|
42
|
+
selectedDate: PropTypes.string,
|
|
43
|
+
timezone: PropTypes.string,
|
|
44
|
+
visibleMonth: PropTypes.string,
|
|
45
|
+
withYearPicker: PropTypes.object
|
|
46
|
+
};
|
|
25
47
|
const allowedProps = ['as', 'children', 'currentDate', 'disabledDates', 'locale', 'onDateSelected', 'onRequestRenderNextMonth', 'onRequestRenderPrevMonth', 'renderNavigationLabel', 'renderNextMonthButton', 'renderPrevMonthButton', 'renderWeekdayLabels', 'role', 'selectedDate', 'timezone', 'visibleMonth'];
|
|
26
|
-
export { allowedProps };
|
|
48
|
+
export { propTypes, allowedProps };
|
|
@@ -12,13 +12,14 @@ var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleCon
|
|
|
12
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
13
13
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
14
14
|
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
15
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
15
16
|
var _emotion = require("@instructure/emotion");
|
|
16
17
|
var _styles = _interopRequireDefault(require("./styles"));
|
|
17
18
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
18
19
|
var _props = require("./props");
|
|
19
20
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
20
21
|
const _excluded = ["children", "label", "interaction", "isOutsideMonth", "isSelected", "isToday", "onClick", "onKeyDown", "as", "styles"];
|
|
21
|
-
var _dec, _class, _Day;
|
|
22
|
+
var _dec, _dec2, _class, _Day;
|
|
22
23
|
/*
|
|
23
24
|
* The MIT License (MIT)
|
|
24
25
|
*
|
|
@@ -48,7 +49,7 @@ parent: Calendar
|
|
|
48
49
|
id: Calendar.Day
|
|
49
50
|
---
|
|
50
51
|
**/
|
|
51
|
-
let Day = exports.Day = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Day = class Day extends _react.Component {
|
|
52
|
+
let Day = exports.Day = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_Day = class Day extends _react.Component {
|
|
52
53
|
constructor(...args) {
|
|
53
54
|
super(...args);
|
|
54
55
|
this.ref = null;
|
|
@@ -137,7 +138,6 @@ let Day = exports.Day = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
137
138
|
onClick: onClick && this.handleClick,
|
|
138
139
|
onKeyDown: onKeyDown && this.handleKeyDown,
|
|
139
140
|
elementRef: this.handleElementRef,
|
|
140
|
-
"data-cid": "Calendar.Day",
|
|
141
141
|
children: (0, _jsxRuntime.jsx)("span", {
|
|
142
142
|
css: styles === null || styles === void 0 ? void 0 : styles.day,
|
|
143
143
|
children: (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
@@ -147,10 +147,10 @@ let Day = exports.Day = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
147
147
|
})
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
}, _Day.displayName = "Day", _Day.componentId = 'Calendar.Day', _Day.allowedProps = _props.allowedProps, _Day.defaultProps = {
|
|
150
|
+
}, _Day.displayName = "Day", _Day.componentId = 'Calendar.Day', _Day.propTypes = _props.propTypes, _Day.allowedProps = _props.allowedProps, _Day.defaultProps = {
|
|
151
151
|
interaction: 'enabled',
|
|
152
152
|
isSelected: false,
|
|
153
153
|
isToday: false,
|
|
154
154
|
isOutsideMonth: false
|
|
155
|
-
}, _Day)) || _class);
|
|
155
|
+
}, _Day)) || _class) || _class);
|
|
156
156
|
var _default = exports.default = Day;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _I18nPropTypes = require("@instructure/ui-i18n/lib/I18nPropTypes.js");
|
|
7
10
|
/*
|
|
8
11
|
* The MIT License (MIT)
|
|
9
12
|
*
|
|
@@ -28,4 +31,17 @@ exports.allowedProps = void 0;
|
|
|
28
31
|
* SOFTWARE.
|
|
29
32
|
*/
|
|
30
33
|
|
|
34
|
+
const propTypes = exports.propTypes = {
|
|
35
|
+
children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
36
|
+
date: _I18nPropTypes.I18nPropTypes.iso8601.isRequired,
|
|
37
|
+
label: _propTypes.default.string.isRequired,
|
|
38
|
+
interaction: _propTypes.default.oneOf(['enabled', 'disabled']),
|
|
39
|
+
isSelected: _propTypes.default.bool,
|
|
40
|
+
isToday: _propTypes.default.bool,
|
|
41
|
+
isOutsideMonth: _propTypes.default.bool,
|
|
42
|
+
onClick: _propTypes.default.func,
|
|
43
|
+
onKeyDown: _propTypes.default.func,
|
|
44
|
+
elementRef: _propTypes.default.func,
|
|
45
|
+
as: _propTypes.default.elementType
|
|
46
|
+
};
|
|
31
47
|
const allowedProps = exports.allowedProps = ['children', 'date', 'label', 'interaction', 'isSelected', 'isToday', 'isOutsideMonth', 'onClick', 'onKeyDown', 'elementRef', 'as'];
|
package/lib/Calendar/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var _withDeterministicId = require("@instructure/ui-react-utils/lib/Deterministi
|
|
|
14
14
|
var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFunction.js");
|
|
15
15
|
var _console = require("@instructure/console");
|
|
16
16
|
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
17
|
+
var _testable = require("@instructure/ui-testable/lib/testable.js");
|
|
17
18
|
var _emotion = require("@instructure/emotion");
|
|
18
19
|
var _Locale = require("@instructure/ui-i18n/lib/Locale.js");
|
|
19
20
|
var _DateTime = require("@instructure/ui-i18n/lib/DateTime.js");
|
|
@@ -27,7 +28,7 @@ var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenS
|
|
|
27
28
|
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
28
29
|
var _SimpleSelect = require("@instructure/ui-simple-select/lib/SimpleSelect");
|
|
29
30
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
30
|
-
var _dec, _dec2, _class, _Calendar, _IconButton, _IconButton2;
|
|
31
|
+
var _dec, _dec2, _dec3, _class, _Calendar, _IconButton, _IconButton2;
|
|
31
32
|
/*
|
|
32
33
|
* The MIT License (MIT)
|
|
33
34
|
*
|
|
@@ -56,7 +57,7 @@ var _dec, _dec2, _class, _Calendar, _IconButton, _IconButton2;
|
|
|
56
57
|
category: components
|
|
57
58
|
---
|
|
58
59
|
**/
|
|
59
|
-
let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Calendar = class Calendar extends _react.Component {
|
|
60
|
+
let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec3 = (0, _testable.testable)(), _dec(_class = _dec2(_class = _dec3(_class = (_Calendar = class Calendar extends _react.Component {
|
|
60
61
|
constructor(props) {
|
|
61
62
|
super(props);
|
|
62
63
|
this.ref = null;
|
|
@@ -407,12 +408,11 @@ let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
407
408
|
padding: "small",
|
|
408
409
|
background: "primary",
|
|
409
410
|
elementRef: this.handleRef,
|
|
410
|
-
"data-cid": "Calendar",
|
|
411
411
|
children: [this.renderHeader(), this.renderBody()]
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
|
-
}, _Calendar.displayName = "Calendar", _Calendar.componentId = 'Calendar', _Calendar.contextType = _ApplyLocaleContext.ApplyLocaleContext, _Calendar.Day = _Day.Day, _Calendar.DAY_COUNT = 42, _Calendar.allowedProps = _props.allowedProps, _Calendar.defaultProps = {
|
|
414
|
+
}, _Calendar.displayName = "Calendar", _Calendar.componentId = 'Calendar', _Calendar.contextType = _ApplyLocaleContext.ApplyLocaleContext, _Calendar.Day = _Day.Day, _Calendar.DAY_COUNT = 42, _Calendar.propTypes = _props.propTypes, _Calendar.allowedProps = _props.allowedProps, _Calendar.defaultProps = {
|
|
415
415
|
as: 'span',
|
|
416
416
|
role: 'table'
|
|
417
|
-
}, _Calendar)) || _class) || _class);
|
|
417
|
+
}, _Calendar)) || _class) || _class) || _class);
|
|
418
418
|
var _default = exports.default = Calendar;
|
package/lib/Calendar/props.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.allowedProps = void 0;
|
|
7
|
+
exports.propTypes = exports.allowedProps = void 0;
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _Children = require("@instructure/ui-prop-types/lib/Children.js");
|
|
10
|
+
var _Day = require("./Day");
|
|
7
11
|
/*
|
|
8
12
|
* The MIT License (MIT)
|
|
9
13
|
*
|
|
@@ -28,4 +32,23 @@ exports.allowedProps = void 0;
|
|
|
28
32
|
* SOFTWARE.
|
|
29
33
|
*/
|
|
30
34
|
|
|
35
|
+
const propTypes = exports.propTypes = {
|
|
36
|
+
as: _propTypes.default.elementType,
|
|
37
|
+
children: _Children.Children.oneOf([_Day.Day]),
|
|
38
|
+
currentDate: _propTypes.default.string,
|
|
39
|
+
disabledDates: _propTypes.default.oneOfType([_propTypes.default.array, _propTypes.default.func]),
|
|
40
|
+
locale: _propTypes.default.string,
|
|
41
|
+
onDateSelected: _propTypes.default.func,
|
|
42
|
+
onRequestRenderNextMonth: _propTypes.default.func,
|
|
43
|
+
onRequestRenderPrevMonth: _propTypes.default.func,
|
|
44
|
+
renderNavigationLabel: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
45
|
+
renderNextMonthButton: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
46
|
+
renderPrevMonthButton: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]),
|
|
47
|
+
renderWeekdayLabels: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])),
|
|
48
|
+
role: _propTypes.default.oneOf(['table', 'listbox']),
|
|
49
|
+
selectedDate: _propTypes.default.string,
|
|
50
|
+
timezone: _propTypes.default.string,
|
|
51
|
+
visibleMonth: _propTypes.default.string,
|
|
52
|
+
withYearPicker: _propTypes.default.object
|
|
53
|
+
};
|
|
31
54
|
const allowedProps = exports.allowedProps = ['as', 'children', 'currentDate', 'disabledDates', 'locale', 'onDateSelected', 'onRequestRenderNextMonth', 'onRequestRenderPrevMonth', 'renderNavigationLabel', 'renderNextMonthButton', 'renderPrevMonthButton', 'renderWeekdayLabels', 'role', 'selectedDate', 'timezone', 'visibleMonth'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-calendar",
|
|
3
|
-
"version": "10.26.
|
|
3
|
+
"version": "10.26.2",
|
|
4
4
|
"description": "A calendar component.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,31 +23,34 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-babel-preset": "10.26.
|
|
27
|
-
"@instructure/ui-color-utils": "10.26.
|
|
28
|
-
"@instructure/ui-themes": "10.26.
|
|
26
|
+
"@instructure/ui-babel-preset": "10.26.2",
|
|
27
|
+
"@instructure/ui-color-utils": "10.26.2",
|
|
28
|
+
"@instructure/ui-themes": "10.26.2",
|
|
29
29
|
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
-
"@testing-library/react": "
|
|
30
|
+
"@testing-library/react": "^16.0.1",
|
|
31
31
|
"@testing-library/user-event": "^14.6.1",
|
|
32
32
|
"vitest": "^3.2.2"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/runtime": "^7.27.6",
|
|
36
|
-
"@instructure/console": "10.26.
|
|
37
|
-
"@instructure/emotion": "10.26.
|
|
38
|
-
"@instructure/shared-types": "10.26.
|
|
39
|
-
"@instructure/ui-a11y-content": "10.26.
|
|
40
|
-
"@instructure/ui-buttons": "10.26.
|
|
41
|
-
"@instructure/ui-i18n": "10.26.
|
|
42
|
-
"@instructure/ui-icons": "10.26.
|
|
43
|
-
"@instructure/ui-
|
|
44
|
-
"@instructure/ui-
|
|
45
|
-
"@instructure/ui-
|
|
46
|
-
"@instructure/ui-
|
|
47
|
-
"@instructure/
|
|
36
|
+
"@instructure/console": "10.26.2",
|
|
37
|
+
"@instructure/emotion": "10.26.2",
|
|
38
|
+
"@instructure/shared-types": "10.26.2",
|
|
39
|
+
"@instructure/ui-a11y-content": "10.26.2",
|
|
40
|
+
"@instructure/ui-buttons": "10.26.2",
|
|
41
|
+
"@instructure/ui-i18n": "10.26.2",
|
|
42
|
+
"@instructure/ui-icons": "10.26.2",
|
|
43
|
+
"@instructure/ui-prop-types": "10.26.2",
|
|
44
|
+
"@instructure/ui-react-utils": "10.26.2",
|
|
45
|
+
"@instructure/ui-simple-select": "10.26.2",
|
|
46
|
+
"@instructure/ui-testable": "10.26.2",
|
|
47
|
+
"@instructure/ui-utils": "10.26.2",
|
|
48
|
+
"@instructure/ui-view": "10.26.2",
|
|
49
|
+
"@instructure/uid": "10.26.2",
|
|
50
|
+
"prop-types": "^15.8.1"
|
|
48
51
|
},
|
|
49
52
|
"peerDependencies": {
|
|
50
|
-
"react": ">=
|
|
53
|
+
"react": ">=16.14 <=18"
|
|
51
54
|
},
|
|
52
55
|
"publishConfig": {
|
|
53
56
|
"access": "public"
|
|
@@ -33,12 +33,14 @@ import {
|
|
|
33
33
|
getElementType
|
|
34
34
|
} from '@instructure/ui-react-utils'
|
|
35
35
|
|
|
36
|
+
import { testable } from '@instructure/ui-testable'
|
|
37
|
+
|
|
36
38
|
import { withStyle } from '@instructure/emotion'
|
|
37
39
|
|
|
38
40
|
import generateStyle from './styles'
|
|
39
41
|
import generateComponentTheme from './theme'
|
|
40
42
|
|
|
41
|
-
import { allowedProps } from './props'
|
|
43
|
+
import { propTypes, allowedProps } from './props'
|
|
42
44
|
import type { CalendarDayProps, CalendarDayStyleProps } from './props'
|
|
43
45
|
|
|
44
46
|
/**
|
|
@@ -48,9 +50,11 @@ id: Calendar.Day
|
|
|
48
50
|
---
|
|
49
51
|
**/
|
|
50
52
|
@withStyle(generateStyle, generateComponentTheme)
|
|
53
|
+
@testable()
|
|
51
54
|
class Day extends Component<CalendarDayProps> {
|
|
52
55
|
static readonly componentId = 'Calendar.Day'
|
|
53
56
|
|
|
57
|
+
static propTypes = propTypes
|
|
54
58
|
static allowedProps = allowedProps
|
|
55
59
|
static defaultProps = {
|
|
56
60
|
interaction: 'enabled',
|
|
@@ -161,7 +165,6 @@ class Day extends Component<CalendarDayProps> {
|
|
|
161
165
|
onClick={onClick && this.handleClick}
|
|
162
166
|
onKeyDown={onKeyDown && this.handleKeyDown}
|
|
163
167
|
elementRef={this.handleElementRef}
|
|
164
|
-
data-cid="Calendar.Day"
|
|
165
168
|
>
|
|
166
169
|
<span css={styles?.day}>
|
|
167
170
|
<AccessibleContent alt={label}>
|
|
@@ -22,8 +22,12 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
import { I18nPropTypes } from '@instructure/ui-i18n'
|
|
27
|
+
|
|
25
28
|
import type {
|
|
26
29
|
AsElementType,
|
|
30
|
+
PropValidators,
|
|
27
31
|
CalendarDayTheme,
|
|
28
32
|
OtherHTMLAttributes
|
|
29
33
|
} from '@instructure/shared-types'
|
|
@@ -108,6 +112,21 @@ type CalendarDayProps = CalendarDayOwnProps &
|
|
|
108
112
|
OtherHTMLAttributes<CalendarDayOwnProps>
|
|
109
113
|
|
|
110
114
|
type CalendarDayStyle = ComponentStyle<'calendarDay' | 'day'>
|
|
115
|
+
|
|
116
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
117
|
+
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
118
|
+
date: I18nPropTypes.iso8601.isRequired,
|
|
119
|
+
label: PropTypes.string.isRequired,
|
|
120
|
+
interaction: PropTypes.oneOf(['enabled', 'disabled']),
|
|
121
|
+
isSelected: PropTypes.bool,
|
|
122
|
+
isToday: PropTypes.bool,
|
|
123
|
+
isOutsideMonth: PropTypes.bool,
|
|
124
|
+
onClick: PropTypes.func,
|
|
125
|
+
onKeyDown: PropTypes.func,
|
|
126
|
+
elementRef: PropTypes.func,
|
|
127
|
+
as: PropTypes.elementType
|
|
128
|
+
}
|
|
129
|
+
|
|
111
130
|
const allowedProps: AllowedPropKeys = [
|
|
112
131
|
'children',
|
|
113
132
|
'date',
|
|
@@ -123,4 +142,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
123
142
|
]
|
|
124
143
|
|
|
125
144
|
export type { CalendarDayProps, CalendarDayStyleProps, CalendarDayStyle }
|
|
126
|
-
export { allowedProps }
|
|
145
|
+
export { propTypes, allowedProps }
|
package/src/Calendar/index.tsx
CHANGED
|
@@ -35,6 +35,8 @@ import { createChainedFunction } from '@instructure/ui-utils'
|
|
|
35
35
|
import { logError as error } from '@instructure/console'
|
|
36
36
|
import { AccessibleContent } from '@instructure/ui-a11y-content'
|
|
37
37
|
|
|
38
|
+
import { testable } from '@instructure/ui-testable'
|
|
39
|
+
|
|
38
40
|
import { withStyle } from '@instructure/emotion'
|
|
39
41
|
|
|
40
42
|
import { Locale, DateTime, ApplyLocaleContext } from '@instructure/ui-i18n'
|
|
@@ -45,7 +47,7 @@ import generateComponentTheme from './theme'
|
|
|
45
47
|
|
|
46
48
|
import { Day } from './Day'
|
|
47
49
|
|
|
48
|
-
import { allowedProps } from './props'
|
|
50
|
+
import { propTypes, allowedProps } from './props'
|
|
49
51
|
import type { CalendarProps, CalendarState } from './props'
|
|
50
52
|
import { Renderable } from '@instructure/shared-types'
|
|
51
53
|
|
|
@@ -64,6 +66,7 @@ category: components
|
|
|
64
66
|
**/
|
|
65
67
|
@withDeterministicId()
|
|
66
68
|
@withStyle(generateStyle, generateComponentTheme)
|
|
69
|
+
@testable()
|
|
67
70
|
class Calendar extends Component<CalendarProps, CalendarState> {
|
|
68
71
|
static readonly componentId = 'Calendar'
|
|
69
72
|
|
|
@@ -72,6 +75,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
72
75
|
static Day = Day
|
|
73
76
|
static DAY_COUNT = 42 // 6 weeks visible
|
|
74
77
|
|
|
78
|
+
static propTypes = propTypes
|
|
75
79
|
static allowedProps = allowedProps
|
|
76
80
|
static defaultProps = {
|
|
77
81
|
as: 'span',
|
|
@@ -260,7 +264,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
260
264
|
const { prevButton, nextButton } = this.renderMonthNavigationButtons()
|
|
261
265
|
|
|
262
266
|
const cloneButton = (
|
|
263
|
-
button: ReactElement
|
|
267
|
+
button: ReactElement,
|
|
264
268
|
onClick?: (e: React.MouseEvent) => void
|
|
265
269
|
) =>
|
|
266
270
|
safeCloneElement(button, {
|
|
@@ -424,7 +428,7 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
424
428
|
)
|
|
425
429
|
|
|
426
430
|
return childrenArr
|
|
427
|
-
.reduce((days: ReactElement
|
|
431
|
+
.reduce((days: ReactElement[][], day, i) => {
|
|
428
432
|
const index = Math.floor(i / 7)
|
|
429
433
|
if (!days[index]) days.push([])
|
|
430
434
|
days[index].push(day)
|
|
@@ -548,7 +552,6 @@ class Calendar extends Component<CalendarProps, CalendarState> {
|
|
|
548
552
|
padding="small"
|
|
549
553
|
background="primary"
|
|
550
554
|
elementRef={this.handleRef}
|
|
551
|
-
data-cid="Calendar"
|
|
552
555
|
>
|
|
553
556
|
{this.renderHeader()}
|
|
554
557
|
{this.renderBody()}
|
package/src/Calendar/props.ts
CHANGED
|
@@ -22,8 +22,14 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import PropTypes from 'prop-types'
|
|
26
|
+
|
|
27
|
+
import { Children as ChildrenPropTypes } from '@instructure/ui-prop-types'
|
|
28
|
+
import { Day } from './Day'
|
|
29
|
+
|
|
25
30
|
import type {
|
|
26
31
|
AsElementType,
|
|
32
|
+
PropValidators,
|
|
27
33
|
CalendarTheme,
|
|
28
34
|
OtherHTMLAttributes
|
|
29
35
|
} from '@instructure/shared-types'
|
|
@@ -179,6 +185,29 @@ type CalendarProps = CalendarOwnProps &
|
|
|
179
185
|
type CalendarStyle = ComponentStyle<
|
|
180
186
|
'navigation' | 'navigationWithButtons' | 'weekdayHeader' | 'yearPicker'
|
|
181
187
|
>
|
|
188
|
+
|
|
189
|
+
const propTypes: PropValidators<PropKeys> = {
|
|
190
|
+
as: PropTypes.elementType,
|
|
191
|
+
children: ChildrenPropTypes.oneOf([Day]),
|
|
192
|
+
currentDate: PropTypes.string,
|
|
193
|
+
disabledDates: PropTypes.oneOfType([PropTypes.array, PropTypes.func]),
|
|
194
|
+
locale: PropTypes.string,
|
|
195
|
+
onDateSelected: PropTypes.func,
|
|
196
|
+
onRequestRenderNextMonth: PropTypes.func,
|
|
197
|
+
onRequestRenderPrevMonth: PropTypes.func,
|
|
198
|
+
renderNavigationLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
199
|
+
renderNextMonthButton: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
200
|
+
renderPrevMonthButton: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
201
|
+
renderWeekdayLabels: PropTypes.arrayOf(
|
|
202
|
+
PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
203
|
+
),
|
|
204
|
+
role: PropTypes.oneOf(['table', 'listbox']),
|
|
205
|
+
selectedDate: PropTypes.string,
|
|
206
|
+
timezone: PropTypes.string,
|
|
207
|
+
visibleMonth: PropTypes.string,
|
|
208
|
+
withYearPicker: PropTypes.object
|
|
209
|
+
}
|
|
210
|
+
|
|
182
211
|
const allowedProps: AllowedPropKeys = [
|
|
183
212
|
'as',
|
|
184
213
|
'children',
|
|
@@ -204,4 +233,4 @@ type CalendarState = {
|
|
|
204
233
|
}
|
|
205
234
|
|
|
206
235
|
export type { CalendarProps, CalendarStyle, CalendarState }
|
|
207
|
-
export { allowedProps }
|
|
236
|
+
export { propTypes, allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
{ "path": "../shared-types/tsconfig.build.json" },
|
|
16
16
|
{ "path": "../ui-a11y-content/tsconfig.build.json" },
|
|
17
17
|
{ "path": "../ui-i18n/tsconfig.build.json" },
|
|
18
|
+
{ "path": "../ui-prop-types/tsconfig.build.json" },
|
|
18
19
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
20
|
+
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
19
21
|
{ "path": "../ui-utils/tsconfig.build.json" },
|
|
20
22
|
{ "path": "../ui-view/tsconfig.build.json" },
|
|
21
23
|
{ "path": "../uid/tsconfig.build.json" },
|