@instructure/ui-calendar 11.6.0 → 11.6.1-snapshot-129
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 +36 -286
- package/es/Calendar/{Day → v1/Day}/index.js +2 -2
- package/es/Calendar/{index.js → v1/index.js} +4 -4
- package/es/Calendar/v2/Day/index.js +148 -0
- package/{src/index.ts → es/Calendar/v2/Day/props.js} +2 -4
- package/es/Calendar/v2/Day/styles.js +78 -0
- package/es/Calendar/v2/index.js +407 -0
- package/es/Calendar/v2/props.js +26 -0
- package/es/Calendar/v2/styles.js +66 -0
- package/es/{index.js → exports/a.js} +2 -2
- package/es/exports/b.js +25 -0
- package/lib/Calendar/{Day → v1/Day}/index.js +4 -4
- package/lib/Calendar/{index.js → v1/index.js} +12 -12
- package/lib/Calendar/v2/Day/index.js +155 -0
- package/lib/Calendar/v2/Day/props.js +31 -0
- package/lib/Calendar/v2/Day/styles.js +84 -0
- package/lib/Calendar/v2/index.js +416 -0
- package/lib/Calendar/v2/props.js +31 -0
- package/lib/Calendar/v2/styles.js +72 -0
- package/lib/{index.js → exports/a.js} +3 -3
- package/lib/exports/b.js +19 -0
- package/package.json +45 -23
- package/src/Calendar/{Day → v1/Day}/index.tsx +3 -3
- package/src/Calendar/{Day → v1/Day}/props.ts +1 -1
- package/src/Calendar/{index.tsx → v1/index.tsx} +4 -4
- package/src/Calendar/v2/Day/index.tsx +176 -0
- package/src/Calendar/v2/Day/props.ts +126 -0
- package/src/Calendar/v2/Day/styles.ts +96 -0
- package/src/Calendar/v2/README.md +255 -0
- package/src/Calendar/v2/index.tsx +560 -0
- package/src/Calendar/v2/props.ts +207 -0
- package/src/Calendar/v2/styles.ts +75 -0
- package/src/exports/a.ts +28 -0
- package/src/exports/b.ts +28 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Calendar/{Day → v1/Day}/index.d.ts +1 -1
- package/types/Calendar/v1/Day/index.d.ts.map +1 -0
- package/types/Calendar/{Day → v1/Day}/props.d.ts +1 -1
- package/types/Calendar/v1/Day/props.d.ts.map +1 -0
- package/types/Calendar/v1/Day/styles.d.ts.map +1 -0
- package/types/Calendar/v1/Day/theme.d.ts.map +1 -0
- package/types/Calendar/{index.d.ts → v1/index.d.ts} +1 -1
- package/types/Calendar/v1/index.d.ts.map +1 -0
- package/types/Calendar/v1/props.d.ts.map +1 -0
- package/types/Calendar/v1/styles.d.ts.map +1 -0
- package/types/Calendar/v1/theme.d.ts.map +1 -0
- package/types/Calendar/v2/Day/index.d.ts +49 -0
- package/types/Calendar/v2/Day/index.d.ts.map +1 -0
- package/types/Calendar/v2/Day/props.d.ts +76 -0
- package/types/Calendar/v2/Day/props.d.ts.map +1 -0
- package/types/Calendar/v2/Day/styles.d.ts +15 -0
- package/types/Calendar/v2/Day/styles.d.ts.map +1 -0
- package/types/Calendar/v2/index.d.ts +84 -0
- package/types/Calendar/v2/index.d.ts.map +1 -0
- package/types/Calendar/v2/props.d.ts +135 -0
- package/types/Calendar/v2/props.d.ts.map +1 -0
- package/types/Calendar/v2/styles.d.ts +13 -0
- package/types/Calendar/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +5 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
- package/types/Calendar/Day/index.d.ts.map +0 -1
- package/types/Calendar/Day/props.d.ts.map +0 -1
- package/types/Calendar/Day/styles.d.ts.map +0 -1
- package/types/Calendar/Day/theme.d.ts.map +0 -1
- package/types/Calendar/index.d.ts.map +0 -1
- package/types/Calendar/props.d.ts.map +0 -1
- package/types/Calendar/styles.d.ts.map +0 -1
- package/types/Calendar/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +0 -1
- /package/es/Calendar/{Day → v1/Day}/props.js +0 -0
- /package/es/Calendar/{Day → v1/Day}/styles.js +0 -0
- /package/es/Calendar/{Day → v1/Day}/theme.js +0 -0
- /package/es/Calendar/{props.js → v1/props.js} +0 -0
- /package/es/Calendar/{styles.js → v1/styles.js} +0 -0
- /package/es/Calendar/{theme.js → v1/theme.js} +0 -0
- /package/lib/Calendar/{Day → v1/Day}/props.js +0 -0
- /package/lib/Calendar/{Day → v1/Day}/styles.js +0 -0
- /package/lib/Calendar/{Day → v1/Day}/theme.js +0 -0
- /package/lib/Calendar/{props.js → v1/props.js} +0 -0
- /package/lib/Calendar/{styles.js → v1/styles.js} +0 -0
- /package/lib/Calendar/{theme.js → v1/theme.js} +0 -0
- /package/src/Calendar/{Day → v1/Day}/styles.ts +0 -0
- /package/src/Calendar/{Day → v1/Day}/theme.ts +0 -0
- /package/src/Calendar/{README.md → v1/README.md} +0 -0
- /package/src/Calendar/{props.ts → v1/props.ts} +0 -0
- /package/src/Calendar/{styles.ts → v1/styles.ts} +0 -0
- /package/src/Calendar/{theme.ts → v1/theme.ts} +0 -0
- /package/types/Calendar/{Day → v1/Day}/styles.d.ts +0 -0
- /package/types/Calendar/{Day → v1/Day}/theme.d.ts +0 -0
- /package/types/Calendar/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/Calendar/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/Calendar/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* ---
|
|
27
|
+
* private: true
|
|
28
|
+
* ---
|
|
29
|
+
* Generates the style object from the theme and provided additional information
|
|
30
|
+
* @param {Object} componentTheme The theme variable object.
|
|
31
|
+
* @return {Object} The final style object, which will be used in the component
|
|
32
|
+
*/
|
|
33
|
+
const generateStyle = (componentTheme, props) => {
|
|
34
|
+
const withYearPicker = props.withYearPicker;
|
|
35
|
+
return {
|
|
36
|
+
navigation: {
|
|
37
|
+
label: 'calendar__navigation',
|
|
38
|
+
textAlign: 'center',
|
|
39
|
+
color: componentTheme.color,
|
|
40
|
+
background: componentTheme.background,
|
|
41
|
+
fontFamily: componentTheme.fontFamily,
|
|
42
|
+
fontSize: componentTheme.fontSize,
|
|
43
|
+
fontWeight: componentTheme.fontWeight,
|
|
44
|
+
marginBottom: withYearPicker ? componentTheme.navWithYearMargin : componentTheme.navMargin
|
|
45
|
+
},
|
|
46
|
+
navigationWithButtons: {
|
|
47
|
+
label: 'calendar__navigation--withButtons',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: 'space-between'
|
|
51
|
+
},
|
|
52
|
+
weekdayHeader: {
|
|
53
|
+
label: 'calendar__weekdayHeader',
|
|
54
|
+
textAlign: 'center',
|
|
55
|
+
maxWidth: componentTheme.maxHeaderWidth,
|
|
56
|
+
lineHeight: componentTheme.lineHeight
|
|
57
|
+
},
|
|
58
|
+
yearPicker: {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
justifyContent: 'center',
|
|
61
|
+
alignItems: 'center',
|
|
62
|
+
marginBottom: componentTheme.yearPickerMargin
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
export default generateStyle;
|
|
@@ -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
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
export { Calendar } from "../Calendar/v2/index.js";
|
|
25
|
+
export { Day as CalendarDay } from "../Calendar/v2/Day/index.js";
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.Day = void 0;
|
|
8
8
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var
|
|
10
|
+
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
11
11
|
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
12
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
13
13
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
@@ -48,7 +48,7 @@ parent: Calendar
|
|
|
48
48
|
id: Calendar.Day
|
|
49
49
|
---
|
|
50
50
|
**/
|
|
51
|
-
let Day = exports.Day = (_dec = (0, _emotion.
|
|
51
|
+
let Day = exports.Day = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_Day = class Day extends _react.Component {
|
|
52
52
|
constructor(...args) {
|
|
53
53
|
super(...args);
|
|
54
54
|
this.ref = null;
|
|
@@ -120,8 +120,8 @@ let Day = exports.Day = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.
|
|
|
120
120
|
props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
|
|
121
121
|
const elementType = this.elementType,
|
|
122
122
|
isDisabled = this.isDisabled;
|
|
123
|
-
const passthroughProps =
|
|
124
|
-
return (0, _jsxRuntime.jsx)(
|
|
123
|
+
const passthroughProps = _v11_.View.omitViewProps((0, _omitProps.omitProps)(props, Day.allowedProps), Day);
|
|
124
|
+
return (0, _jsxRuntime.jsx)(_v11_.View, {
|
|
125
125
|
...passthroughProps,
|
|
126
126
|
as: elementType,
|
|
127
127
|
css: styles === null || styles === void 0 ? void 0 : styles.calendarDay,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.Calendar = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
10
10
|
var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
|
|
11
11
|
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
12
12
|
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
@@ -22,10 +22,10 @@ var _styles = _interopRequireDefault(require("./styles"));
|
|
|
22
22
|
var _theme = _interopRequireDefault(require("./theme"));
|
|
23
23
|
var _Day = require("./Day");
|
|
24
24
|
var _props = require("./props");
|
|
25
|
-
var
|
|
26
|
-
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/IconArrowOpenStartSolid.js");
|
|
27
|
-
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/IconArrowOpenEndSolid.js");
|
|
28
|
-
var
|
|
25
|
+
var _v11_2 = require("@instructure/ui-buttons/v11_6");
|
|
26
|
+
var _IconArrowOpenStartSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenStartSolid.js");
|
|
27
|
+
var _IconArrowOpenEndSolid = require("@instructure/ui-icons/lib/generated/IconArrowOpenEndSolid.js");
|
|
28
|
+
var _v11_3 = require("@instructure/ui-simple-select/v11_6");
|
|
29
29
|
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
30
30
|
var _dec, _dec2, _class, _Calendar, _IconButton, _IconButton2;
|
|
31
31
|
/*
|
|
@@ -56,7 +56,7 @@ var _dec, _dec2, _class, _Calendar, _IconButton, _IconButton2;
|
|
|
56
56
|
category: components
|
|
57
57
|
---
|
|
58
58
|
**/
|
|
59
|
-
let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.
|
|
59
|
+
let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Calendar = class Calendar extends _react.Component {
|
|
60
60
|
constructor(props) {
|
|
61
61
|
super(props);
|
|
62
62
|
this.ref = null;
|
|
@@ -76,7 +76,7 @@ let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
76
76
|
renderNextMonthButton = _this$props.renderNextMonthButton,
|
|
77
77
|
renderPrevMonthButton = _this$props.renderPrevMonthButton;
|
|
78
78
|
return {
|
|
79
|
-
prevButton: renderPrevMonthButton ? (0, _callRenderProp.callRenderProp)(renderPrevMonthButton) : _IconButton || (_IconButton = (0, _jsxRuntime.jsx)(
|
|
79
|
+
prevButton: renderPrevMonthButton ? (0, _callRenderProp.callRenderProp)(renderPrevMonthButton) : _IconButton || (_IconButton = (0, _jsxRuntime.jsx)(_v11_2.IconButton, {
|
|
80
80
|
size: "small",
|
|
81
81
|
withBackground: false,
|
|
82
82
|
withBorder: false,
|
|
@@ -85,7 +85,7 @@ let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
85
85
|
}),
|
|
86
86
|
screenReaderLabel: "Previous month"
|
|
87
87
|
})),
|
|
88
|
-
nextButton: renderNextMonthButton ? (0, _callRenderProp.callRenderProp)(renderNextMonthButton) : _IconButton2 || (_IconButton2 = (0, _jsxRuntime.jsx)(
|
|
88
|
+
nextButton: renderNextMonthButton ? (0, _callRenderProp.callRenderProp)(renderNextMonthButton) : _IconButton2 || (_IconButton2 = (0, _jsxRuntime.jsx)(_v11_2.IconButton, {
|
|
89
89
|
size: "small",
|
|
90
90
|
withBackground: false,
|
|
91
91
|
withBorder: false,
|
|
@@ -231,7 +231,7 @@ let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
231
231
|
}), nextButton && cloneButton(nextButton, this.handleMonthChange('next'))]
|
|
232
232
|
}), withYearPicker ? (0, _jsxRuntime.jsx)("div", {
|
|
233
233
|
css: styles === null || styles === void 0 ? void 0 : styles.yearPicker,
|
|
234
|
-
children: (0, _jsxRuntime.jsx)(
|
|
234
|
+
children: (0, _jsxRuntime.jsx)(_v11_3.SimpleSelect, {
|
|
235
235
|
width: "90px",
|
|
236
236
|
renderLabel: "",
|
|
237
237
|
placeholder: "--",
|
|
@@ -240,7 +240,7 @@ let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
240
240
|
onChange: (e, {
|
|
241
241
|
value
|
|
242
242
|
}) => this.handleYearChange(e, `${value}`),
|
|
243
|
-
children: yearList.map(year => (0, _jsxRuntime.jsx)(
|
|
243
|
+
children: yearList.map(year => (0, _jsxRuntime.jsx)(_v11_3.SimpleSelect.Option, {
|
|
244
244
|
id: `opt-${year}`,
|
|
245
245
|
value: year,
|
|
246
246
|
children: `${year}`
|
|
@@ -399,8 +399,8 @@ let Calendar = exports.Calendar = (_dec = (0, _withDeterministicId.withDetermini
|
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
401
|
render() {
|
|
402
|
-
const passthroughProps =
|
|
403
|
-
return (0, _jsxRuntime.jsxs)(
|
|
402
|
+
const passthroughProps = _v11_.View.omitViewProps((0, _omitProps.omitProps)(this.props, Calendar.allowedProps), Calendar);
|
|
403
|
+
return (0, _jsxRuntime.jsxs)(_v11_.View, {
|
|
404
404
|
...passthroughProps,
|
|
405
405
|
as: this.props.as,
|
|
406
406
|
display: "inline-block",
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.Day = void 0;
|
|
8
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _latest = require("@instructure/ui-view/latest");
|
|
11
|
+
var _AccessibleContent = require("@instructure/ui-a11y-content/lib/AccessibleContent");
|
|
12
|
+
var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
|
|
13
|
+
var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
|
|
14
|
+
var _getElementType = require("@instructure/ui-react-utils/lib/getElementType.js");
|
|
15
|
+
var _emotion = require("@instructure/emotion");
|
|
16
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
17
|
+
var _props = require("./props");
|
|
18
|
+
var _jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
19
|
+
const _excluded = ["children", "label", "interaction", "isOutsideMonth", "isSelected", "isToday", "onClick", "onKeyDown", "as", "styles"];
|
|
20
|
+
var _dec, _class, _Day;
|
|
21
|
+
/*
|
|
22
|
+
* The MIT License (MIT)
|
|
23
|
+
*
|
|
24
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
25
|
+
*
|
|
26
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
28
|
+
* in the Software without restriction, including without limitation the rights
|
|
29
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
30
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
31
|
+
* furnished to do so, subject to the following conditions:
|
|
32
|
+
*
|
|
33
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
34
|
+
* copies or substantial portions of the Software.
|
|
35
|
+
*
|
|
36
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
38
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
39
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
40
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
41
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
|
+
* SOFTWARE.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
---
|
|
46
|
+
parent: Calendar
|
|
47
|
+
id: Calendar.Day
|
|
48
|
+
---
|
|
49
|
+
**/
|
|
50
|
+
let Day = exports.Day = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Day = class Day extends _react.Component {
|
|
51
|
+
constructor(...args) {
|
|
52
|
+
super(...args);
|
|
53
|
+
this.ref = null;
|
|
54
|
+
this.handleClick = event => {
|
|
55
|
+
const _this$props = this.props,
|
|
56
|
+
onClick = _this$props.onClick,
|
|
57
|
+
date = _this$props.date;
|
|
58
|
+
if (typeof onClick === 'function') {
|
|
59
|
+
onClick(event, {
|
|
60
|
+
date
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
this.handleKeyDown = event => {
|
|
65
|
+
const _this$props2 = this.props,
|
|
66
|
+
onKeyDown = _this$props2.onKeyDown,
|
|
67
|
+
date = _this$props2.date;
|
|
68
|
+
if (typeof onKeyDown === 'function') {
|
|
69
|
+
onKeyDown(event, {
|
|
70
|
+
date
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
this.handleElementRef = el => {
|
|
75
|
+
const elementRef = this.props.elementRef;
|
|
76
|
+
this.ref = el;
|
|
77
|
+
if (typeof elementRef === 'function') {
|
|
78
|
+
elementRef(el);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
componentDidMount() {
|
|
83
|
+
var _this$props$makeStyle, _this$props3;
|
|
84
|
+
(_this$props$makeStyle = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props3, this.makeStylesVariables);
|
|
85
|
+
}
|
|
86
|
+
componentDidUpdate() {
|
|
87
|
+
var _this$props$makeStyle2, _this$props4;
|
|
88
|
+
(_this$props$makeStyle2 = (_this$props4 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props4, this.makeStylesVariables);
|
|
89
|
+
}
|
|
90
|
+
get makeStylesVariables() {
|
|
91
|
+
return {
|
|
92
|
+
isDisabled: this.isDisabled
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
get isDisabled() {
|
|
96
|
+
const interaction = this.props.interaction;
|
|
97
|
+
return interaction === 'disabled';
|
|
98
|
+
}
|
|
99
|
+
get elementType() {
|
|
100
|
+
const as = this.props.as;
|
|
101
|
+
return as || (0, _getElementType.getElementType)(Day, this.props);
|
|
102
|
+
}
|
|
103
|
+
shouldApplyAriaSelected() {
|
|
104
|
+
const role = this.props.role;
|
|
105
|
+
return !!role && ['option', 'gridcell'].indexOf(role) > -1;
|
|
106
|
+
}
|
|
107
|
+
render() {
|
|
108
|
+
const _this$props5 = this.props,
|
|
109
|
+
children = _this$props5.children,
|
|
110
|
+
label = _this$props5.label,
|
|
111
|
+
interaction = _this$props5.interaction,
|
|
112
|
+
isOutsideMonth = _this$props5.isOutsideMonth,
|
|
113
|
+
isSelected = _this$props5.isSelected,
|
|
114
|
+
isToday = _this$props5.isToday,
|
|
115
|
+
onClick = _this$props5.onClick,
|
|
116
|
+
onKeyDown = _this$props5.onKeyDown,
|
|
117
|
+
as = _this$props5.as,
|
|
118
|
+
styles = _this$props5.styles,
|
|
119
|
+
props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
|
|
120
|
+
const elementType = this.elementType,
|
|
121
|
+
isDisabled = this.isDisabled;
|
|
122
|
+
const passthroughProps = _latest.View.omitViewProps((0, _omitProps.omitProps)(props, Day.allowedProps), Day);
|
|
123
|
+
return (0, _jsxRuntime.jsx)(_latest.View, {
|
|
124
|
+
...passthroughProps,
|
|
125
|
+
as: elementType,
|
|
126
|
+
css: styles === null || styles === void 0 ? void 0 : styles.calendarDay,
|
|
127
|
+
display: "inline-block",
|
|
128
|
+
margin: "xxx-small",
|
|
129
|
+
borderWidth: "none",
|
|
130
|
+
borderColor: "transparent",
|
|
131
|
+
background: "transparent",
|
|
132
|
+
cursor: elementType === 'button' || elementType === 'a' ? isDisabled ? 'not-allowed' : 'pointer' : 'auto',
|
|
133
|
+
disabled: isDisabled,
|
|
134
|
+
"aria-current": isToday ? 'date' : void 0,
|
|
135
|
+
"aria-selected": this.shouldApplyAriaSelected() ? isSelected ? 'true' : 'false' : void 0,
|
|
136
|
+
onClick: onClick && this.handleClick,
|
|
137
|
+
onKeyDown: onKeyDown && this.handleKeyDown,
|
|
138
|
+
elementRef: this.handleElementRef,
|
|
139
|
+
"data-cid": "Calendar.Day",
|
|
140
|
+
children: (0, _jsxRuntime.jsx)("span", {
|
|
141
|
+
css: styles === null || styles === void 0 ? void 0 : styles.day,
|
|
142
|
+
children: (0, _jsxRuntime.jsx)(_AccessibleContent.AccessibleContent, {
|
|
143
|
+
alt: label,
|
|
144
|
+
children: (0, _callRenderProp.callRenderProp)(children)
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}, _Day.displayName = "Day", _Day.componentId = 'Calendar.Day', _Day.allowedProps = _props.allowedProps, _Day.defaultProps = {
|
|
150
|
+
interaction: 'enabled',
|
|
151
|
+
isSelected: false,
|
|
152
|
+
isToday: false,
|
|
153
|
+
isOutsideMonth: false
|
|
154
|
+
}, _Day)) || _class);
|
|
155
|
+
var _default = exports.default = Day;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.allowedProps = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
const allowedProps = exports.allowedProps = ['children', 'date', 'label', 'interaction', 'isSelected', 'isToday', 'isOutsideMonth', 'onClick', 'onKeyDown', 'elementRef', 'as'];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* The MIT License (MIT)
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
11
|
+
*
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
* in the Software without restriction, including without limitation the rights
|
|
15
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
* furnished to do so, subject to the following conditions:
|
|
18
|
+
*
|
|
19
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
* copies or substantial portions of the Software.
|
|
21
|
+
*
|
|
22
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
* SOFTWARE.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* ---
|
|
33
|
+
* private: true
|
|
34
|
+
* ---
|
|
35
|
+
* Generates the style object from the theme and provided additional information
|
|
36
|
+
* @param {Object} componentTheme The theme variable object.
|
|
37
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
38
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
39
|
+
* @return {Object} The final style object, which will be used in the component
|
|
40
|
+
*/
|
|
41
|
+
const generateStyle = (componentTheme, props, _sharedTokens, state) => {
|
|
42
|
+
const isOutsideMonth = props.isOutsideMonth,
|
|
43
|
+
isSelected = props.isSelected,
|
|
44
|
+
isToday = props.isToday;
|
|
45
|
+
const isDisabled = state.isDisabled;
|
|
46
|
+
return {
|
|
47
|
+
calendarDay: {
|
|
48
|
+
label: 'calendarDay',
|
|
49
|
+
padding: 0
|
|
50
|
+
},
|
|
51
|
+
day: {
|
|
52
|
+
label: 'calendarDay__day',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'center',
|
|
56
|
+
background: componentTheme.background,
|
|
57
|
+
color: componentTheme.color,
|
|
58
|
+
fontSize: componentTheme.fontSize,
|
|
59
|
+
textDecoration: 'none',
|
|
60
|
+
lineHeight: 1,
|
|
61
|
+
height: componentTheme.height,
|
|
62
|
+
minWidth: componentTheme.minWidth,
|
|
63
|
+
border: 'none',
|
|
64
|
+
margin: 0,
|
|
65
|
+
...(isOutsideMonth && {
|
|
66
|
+
color: componentTheme.outsideMonthColor
|
|
67
|
+
}),
|
|
68
|
+
...(isSelected && {
|
|
69
|
+
background: componentTheme.selectedBackground,
|
|
70
|
+
borderRadius: componentTheme.selectedBorderRadius,
|
|
71
|
+
color: componentTheme.selectedColor
|
|
72
|
+
}),
|
|
73
|
+
...(isToday && !isSelected && {
|
|
74
|
+
background: componentTheme.todayBackground,
|
|
75
|
+
borderRadius: componentTheme.todayBorderRadius,
|
|
76
|
+
color: componentTheme.todayColor
|
|
77
|
+
}),
|
|
78
|
+
...(isDisabled && {
|
|
79
|
+
opacity: 0.5
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
var _default = exports.default = generateStyle;
|