@instructure/quiz-core 20.4.0 → 20.4.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/common/components/resources/positionBox/PositionBox.js +16 -20
- package/es/common/components/resources/positionBox/styles.js +27 -0
- package/es/common/components/resources/positionBox/theme.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Body/presenter.js +24 -29
- package/es/common/components/resources/quiz/AddContent/Body/styles.js +28 -0
- package/es/common/components/resources/quiz/AddContent/Body/theme.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Button/index.js +29 -28
- package/es/common/components/resources/quiz/AddContent/Button/styles.js +51 -0
- package/es/common/components/resources/quiz/AddContent/Button/theme.js +4 -2
- package/es/common/components/resources/quiz/AddContent/Popover/presenter.js +16 -22
- package/es/common/components/resources/quiz/AddContent/Popover/styles.js +28 -0
- package/es/common/components/resources/quiz/AddContent/Popover/theme.js +4 -2
- package/lib/common/components/resources/positionBox/PositionBox.js +15 -21
- package/lib/common/components/resources/positionBox/styles.js +37 -0
- package/lib/common/components/resources/positionBox/theme.js +6 -3
- package/lib/common/components/resources/quiz/AddContent/Body/presenter.js +21 -29
- package/lib/common/components/resources/quiz/AddContent/Body/styles.js +38 -0
- package/lib/common/components/resources/quiz/AddContent/Body/theme.js +6 -3
- package/lib/common/components/resources/quiz/AddContent/Button/index.js +28 -31
- package/lib/common/components/resources/quiz/AddContent/Button/styles.js +62 -0
- package/lib/common/components/resources/quiz/AddContent/Button/theme.js +6 -3
- package/lib/common/components/resources/quiz/AddContent/Popover/presenter.js +15 -23
- package/lib/common/components/resources/quiz/AddContent/Popover/styles.js +36 -0
- package/lib/common/components/resources/quiz/AddContent/Popover/theme.js +6 -3
- package/package.json +10 -10
|
@@ -5,21 +5,15 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import PropTypes from 'prop-types';
|
|
10
11
|
import { Heading } from '@instructure/ui-heading';
|
|
11
12
|
import { ScreenReaderContent, PresentationContent } from '@instructure/ui-a11y-content';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return "\n\n.kJotW_cESy{align-items:center;background-color:".concat(theme.positionBackgroundColor || 'inherit', ";display:flex;height:").concat(theme.positionDimension || 'inherit', ";justify-content:center;margin-left:-1.2rem;margin-right:").concat(theme.positionMargin || 'inherit', ";min-width:").concat(theme.positionDimension || 'inherit', ";padding:0 ").concat(theme.positionPadding || 'inherit', ";z-index:").concat(theme.positionZIndex || 'inherit', "}\n\nbody.tox-fullscreen .kJotW_cESy{z-index:0}\n\n.kJotW_bUkG{color:").concat(theme.positionTextColor || 'inherit', ";font-size:").concat(theme.positionTextFontSize || 'inherit', "}\n\n@media print{.kJotW_cESy{-webkit-print-color-adjust:exact;color-adjust:exact}}");
|
|
17
|
-
},
|
|
18
|
-
'position': 'kJotW_cESy',
|
|
19
|
-
'positionText': 'kJotW_bUkG'
|
|
20
|
-
};
|
|
21
|
-
import theme from "./theme.js";
|
|
22
|
-
export var PositionBox = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
13
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
14
|
+
import generateStyle from "./styles.js";
|
|
15
|
+
import generateComponentTheme from "./theme.js";
|
|
16
|
+
export var PositionBox = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
23
17
|
_inherits(PositionBox, _Component);
|
|
24
18
|
|
|
25
19
|
var _super = _createSuper(PositionBox);
|
|
@@ -33,16 +27,16 @@ export var PositionBox = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
33
27
|
_createClass(PositionBox, [{
|
|
34
28
|
key: "render",
|
|
35
29
|
value: function render() {
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
|
|
30
|
+
return jsx("div", {
|
|
31
|
+
css: this.props.styles.position
|
|
32
|
+
}, jsx("div", {
|
|
33
|
+
css: this.props.styles.positionText,
|
|
40
34
|
"data-automation": "sdk-position-box-text"
|
|
41
|
-
},
|
|
35
|
+
}, jsx(ScreenReaderContent, {
|
|
42
36
|
as: "div"
|
|
43
|
-
},
|
|
37
|
+
}, jsx(Heading, {
|
|
44
38
|
level: this.props.headingLevel
|
|
45
|
-
}, this.props.headingText)),
|
|
39
|
+
}, this.props.headingText)), jsx(PresentationContent, null, this.props.position)));
|
|
46
40
|
}
|
|
47
41
|
}]);
|
|
48
42
|
|
|
@@ -51,7 +45,9 @@ export var PositionBox = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
51
45
|
}(Component), _class2.propTypes = {
|
|
52
46
|
headingText: PropTypes.string.isRequired,
|
|
53
47
|
headingLevel: PropTypes.string,
|
|
54
|
-
position: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
48
|
+
position: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
49
|
+
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
50
|
+
styles: PropTypes.object
|
|
55
51
|
}, _class2.defaultProps = {
|
|
56
52
|
headingLevel: 'h2'
|
|
57
53
|
}, _temp)) || _class);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
4
|
+
var printMq = '@media print';
|
|
5
|
+
return {
|
|
6
|
+
position: _defineProperty({
|
|
7
|
+
height: componentTheme.positionDimension,
|
|
8
|
+
minWidth: componentTheme.positionDimension,
|
|
9
|
+
marginLeft: '-1.2rem',
|
|
10
|
+
marginRight: componentTheme.positionMargin,
|
|
11
|
+
display: 'flex',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
backgroundColor: componentTheme.positionBackgroundColor,
|
|
15
|
+
padding: "0 ".concat(componentTheme.positionPadding),
|
|
16
|
+
zIndex: componentTheme.positionZIndex
|
|
17
|
+
}, printMq, {
|
|
18
|
+
colorAdjust: 'exact'
|
|
19
|
+
}),
|
|
20
|
+
positionText: {
|
|
21
|
+
fontSize: componentTheme.positionTextFontSize,
|
|
22
|
+
color: componentTheme.positionTextColor
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
colors = _ref.colors,
|
|
4
4
|
typography = _ref.typography;
|
|
@@ -11,4 +11,6 @@ export default function generator(_ref) {
|
|
|
11
11
|
positionTextColor: colors.porcelain,
|
|
12
12
|
positionTextFontSize: typography.fontSizeMedium
|
|
13
13
|
};
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default generateComponentTheme;
|
|
@@ -5,7 +5,8 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import PropTypes from 'prop-types';
|
|
10
11
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
11
12
|
import first from 'lodash/first';
|
|
@@ -14,24 +15,16 @@ import { IconButton } from '@instructure/ui-buttons';
|
|
|
14
15
|
import { Grid } from '@instructure/ui-grid';
|
|
15
16
|
import { View } from '@instructure/ui-view';
|
|
16
17
|
import { Text } from '@instructure/ui-text';
|
|
17
|
-
import {
|
|
18
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
18
19
|
import InteractionTypes from "../../../../shared/InteractionTypes/index.js";
|
|
19
20
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
20
21
|
import { BUILD_TRAY_OPEN, BUILD_TRAY_POSITION, BUILD_TRAY_STIMULUS_ID } from '@instructure/quiz-common';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'popoverHeader': 'GmYGC_cqxf',
|
|
28
|
-
'popoverContent': 'GmYGC_cdWv'
|
|
29
|
-
};
|
|
30
|
-
import theme from "./theme.js";
|
|
31
|
-
|
|
32
|
-
var _ref = /*#__PURE__*/React.createElement(IconBankLine, null);
|
|
33
|
-
|
|
34
|
-
export var AddContentBody = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
22
|
+
import generateStyle from "./styles.js";
|
|
23
|
+
import generateComponentTheme from "./theme.js";
|
|
24
|
+
|
|
25
|
+
var _ref = jsx(IconBankLine, null);
|
|
26
|
+
|
|
27
|
+
export var AddContentBody = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
35
28
|
_inherits(AddContentBody, _Component);
|
|
36
29
|
|
|
37
30
|
var _super = _createSuper(AddContentBody);
|
|
@@ -101,7 +94,7 @@ export var AddContentBody = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
101
94
|
};
|
|
102
95
|
|
|
103
96
|
_this.renderBankButton = function () {
|
|
104
|
-
return
|
|
97
|
+
return jsx(IconButton, {
|
|
105
98
|
size: "large",
|
|
106
99
|
onClick: _this.openBankTray,
|
|
107
100
|
"data-automation": "sdk-add-banked-content-button",
|
|
@@ -111,17 +104,17 @@ export var AddContentBody = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
111
104
|
|
|
112
105
|
_this.renderPopoverHeader = function () {
|
|
113
106
|
var text = _this.props.showHeaderText ? t('Insert Content') : '';
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
},
|
|
107
|
+
return jsx("div", {
|
|
108
|
+
css: _this.props.styles.popoverHeaderBox
|
|
109
|
+
}, jsx("div", {
|
|
110
|
+
css: _this.props.styles.popoverHeader
|
|
111
|
+
}, jsx(Grid, {
|
|
119
112
|
vAlign: "middle",
|
|
120
113
|
colSpacing: "none",
|
|
121
114
|
rowSpacing: "none"
|
|
122
|
-
},
|
|
115
|
+
}, jsx(Grid.Row, null, jsx(Grid.Col, null, jsx(Text, {
|
|
123
116
|
color: "primary"
|
|
124
|
-
}, text)),
|
|
117
|
+
}, text)), jsx(Grid.Col, {
|
|
125
118
|
width: "auto"
|
|
126
119
|
}, _this.renderBankButton())))));
|
|
127
120
|
};
|
|
@@ -132,13 +125,13 @@ export var AddContentBody = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
132
125
|
_createClass(AddContentBody, [{
|
|
133
126
|
key: "render",
|
|
134
127
|
value: function render() {
|
|
135
|
-
return
|
|
136
|
-
|
|
128
|
+
return jsx("div", {
|
|
129
|
+
css: this.props.styles.popoverContent,
|
|
137
130
|
role: "dialog",
|
|
138
131
|
"aria-label": t('Insert Content')
|
|
139
|
-
}, this.renderPopoverHeader(),
|
|
132
|
+
}, this.renderPopoverHeader(), jsx(View, {
|
|
140
133
|
padding: "small"
|
|
141
|
-
},
|
|
134
|
+
}, jsx(InteractionTypes, {
|
|
142
135
|
columns: 2,
|
|
143
136
|
addItem: this.addItem,
|
|
144
137
|
addStimulus: this.addStimulus,
|
|
@@ -166,7 +159,9 @@ export var AddContentBody = (_dec = themeable(theme, styles), _dec(_class = (_te
|
|
|
166
159
|
setNextQuizEntry: PropTypes.func.isRequired,
|
|
167
160
|
setUi: PropTypes.func.isRequired,
|
|
168
161
|
showHeaderText: PropTypes.bool,
|
|
169
|
-
stimulusId: PropTypes.string
|
|
162
|
+
stimulusId: PropTypes.string,
|
|
163
|
+
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
164
|
+
styles: PropTypes.object
|
|
170
165
|
}, _class2.defaultProps = {
|
|
171
166
|
editingQuizEntry: void 0,
|
|
172
167
|
interactionTypes: void 0,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
4
|
+
var _popoverContent;
|
|
5
|
+
|
|
6
|
+
var ieMq = '@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)'; // IE11 only
|
|
7
|
+
|
|
8
|
+
var mobileMq = "@media screen and (".concat(componentTheme.phoneBreakPoint, ") and (-ms-high-contrast: active), screen and (").concat(componentTheme.phoneBreakPoint, ") and (-ms-high-contrast: none)");
|
|
9
|
+
return {
|
|
10
|
+
popoverHeaderBox: {
|
|
11
|
+
borderBottom: "solid ".concat(componentTheme.popoverHeaderBoxBorderWidth, " ").concat(componentTheme.popoverHeaderBoxBorderColor)
|
|
12
|
+
},
|
|
13
|
+
popoverHeader: {
|
|
14
|
+
margin: '1rem',
|
|
15
|
+
marginBottom: '0.25rem'
|
|
16
|
+
},
|
|
17
|
+
popoverContent: (_popoverContent = {
|
|
18
|
+
marginLeft: componentTheme.popoverContentMargin,
|
|
19
|
+
marginRight: componentTheme.popoverContentMargin
|
|
20
|
+
}, _defineProperty(_popoverContent, ieMq, {
|
|
21
|
+
width: '22rem'
|
|
22
|
+
}), _defineProperty(_popoverContent, mobileMq, {
|
|
23
|
+
width: '11rem'
|
|
24
|
+
}), _popoverContent)
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
colors = _ref.colors,
|
|
4
4
|
borders = _ref.borders,
|
|
@@ -10,4 +10,6 @@ export default function generator(_ref) {
|
|
|
10
10
|
popoverHeaderBoxBorderWidth: borders.widthSmall,
|
|
11
11
|
popoverHeaderBoxBorderColor: colors.tiara
|
|
12
12
|
};
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default generateComponentTheme;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
3
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
@@ -6,26 +5,17 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
6
5
|
|
|
7
6
|
var _dec, _class, _class2, _temp;
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
|
-
import classNames from 'classnames';
|
|
12
11
|
import { IconPlusLine } from '@instructure/ui-icons';
|
|
13
12
|
import { PresentationContent, ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
14
13
|
import { Button } from '@instructure/ui-buttons';
|
|
15
|
-
import {
|
|
14
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
16
15
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return "\n\n.cIWJr_ePYF{background-color:".concat(theme.newItemButtonBackgroundColor || 'inherit', ";border:none;border-radius:").concat(theme.newItemButtonBorderRadius || 'inherit', ";box-shadow:").concat(theme.newItemButtonBoxShadow || 'inherit', ";color:").concat(theme.newItemButtonColor || 'inherit', ";font-size:").concat(theme.newItemButtonFontSize || 'inherit', ";font-weight:").concat(theme.newItemButtonFontWeight || 'inherit', ";line-height:0;margin:").concat(theme.newItemButtonMargin || 'inherit', ";padding:").concat(theme.newItemButtonPadding || 'inherit', ";text-align:center;transform:rotate(0deg);transition:").concat(theme.newItemButtonTransition || 'inherit', ";z-index:").concat(theme.newItemButtonZIndex || 'inherit', "}\n\n[dir=ltr] .cIWJr_ePYF,[dir=rtl] .cIWJr_ePYF{text-align:center}\n\n.cIWJr_ePYF:focus{outline:").concat(theme.newItemButtonFocusOutline || 'inherit', ";outline-offset:").concat(theme.newItemButtonFocusOutlineOffset || 'inherit', "}\n\n.cIWJr_ePYF.cIWJr_cwUE{background-color:").concat(theme.newItemButtonEditingBackgroundColor || 'inherit', ";transform:rotate(45deg);transition:").concat(theme.newItemButtonTransition || 'inherit', "}\n\n.cIWJr_ekys{display:flex;justify-content:center;margin-top:-1.5rem;width:100%;z-index:").concat(theme.newItemButtonHolderZIndex || 'inherit', "}\n\n.cIWJr_egTu{display:flex;justify-content:center;width:100%;z-index:").concat(theme.attachQuestionButtonHolderZIndex || 'inherit', "}\n\n@media print{.cIWJr_egTu,.cIWJr_ekys{display:none}}");
|
|
21
|
-
},
|
|
22
|
-
'newItemButton': 'cIWJr_ePYF',
|
|
23
|
-
'newItemButtonEditing': 'cIWJr_cwUE',
|
|
24
|
-
'newItemButtonHolder': 'cIWJr_ekys',
|
|
25
|
-
'attachQuestionButtonHolder': 'cIWJr_egTu'
|
|
26
|
-
};
|
|
27
|
-
import theme from "./theme.js";
|
|
28
|
-
export var AddContentButton = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
16
|
+
import generateStyle from "./styles.js";
|
|
17
|
+
import generateComponentTheme from "./theme.js";
|
|
18
|
+
export var AddContentButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
29
19
|
_inherits(AddContentButton, _Component);
|
|
30
20
|
|
|
31
21
|
var _super = _createSuper(AddContentButton);
|
|
@@ -49,6 +39,16 @@ export var AddContentButton = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
49
39
|
}
|
|
50
40
|
|
|
51
41
|
_createClass(AddContentButton, [{
|
|
42
|
+
key: "componentDidMount",
|
|
43
|
+
value: function componentDidMount() {
|
|
44
|
+
this.props.makeStyles();
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "componentDidUpdate",
|
|
48
|
+
value: function componentDidUpdate() {
|
|
49
|
+
this.props.makeStyles();
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
52
|
key: "focus",
|
|
53
53
|
value: function focus() {
|
|
54
54
|
this.buttonElem.focus();
|
|
@@ -56,9 +56,9 @@ export var AddContentButton = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
56
56
|
}, {
|
|
57
57
|
key: "renderStimulus",
|
|
58
58
|
value: function renderStimulus() {
|
|
59
|
-
return
|
|
60
|
-
|
|
61
|
-
},
|
|
59
|
+
return jsx("div", {
|
|
60
|
+
css: this.props.styles.attachQuestionButtonHolder
|
|
61
|
+
}, jsx(Button, {
|
|
62
62
|
ref: this.storeButtonElemRef,
|
|
63
63
|
color: "primary",
|
|
64
64
|
margin: "medium",
|
|
@@ -69,18 +69,16 @@ export var AddContentButton = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
69
69
|
}, {
|
|
70
70
|
key: "renderNonStimulus",
|
|
71
71
|
value: function renderNonStimulus() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
className: styles.newItemButtonHolder
|
|
77
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
72
|
+
return jsx("div", {
|
|
73
|
+
css: this.props.styles.newItemButtonHolder
|
|
74
|
+
}, jsx("button", {
|
|
78
75
|
ref: this.storeButtonElemRef,
|
|
79
76
|
onClick: this.props.onClick,
|
|
80
|
-
|
|
77
|
+
css: this.props.styles.newItemButton,
|
|
78
|
+
className: this.props.position !== null ? "newItemButton_".concat(this.props.position) : null,
|
|
81
79
|
"data-automation": "sdk-add-content-button",
|
|
82
80
|
"aria-expanded": this.props.isEditing
|
|
83
|
-
},
|
|
81
|
+
}, jsx(ScreenReaderContent, null, t('Add Content')), jsx(PresentationContent, null, jsx(IconPlusLine, {
|
|
84
82
|
title: t('Add Content')
|
|
85
83
|
}))));
|
|
86
84
|
}
|
|
@@ -97,7 +95,10 @@ export var AddContentButton = (_dec = themeable(theme, styles), _dec(_class = (_
|
|
|
97
95
|
isEditing: PropTypes.bool.isRequired,
|
|
98
96
|
onClick: PropTypes.func,
|
|
99
97
|
position: PropTypes.number,
|
|
100
|
-
useStimulusTrigger: PropTypes.bool.isRequired
|
|
98
|
+
useStimulusTrigger: PropTypes.bool.isRequired,
|
|
99
|
+
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
100
|
+
styles: PropTypes.object,
|
|
101
|
+
makeStyles: PropTypes.func
|
|
101
102
|
}, _class2.defaultProps = {
|
|
102
103
|
onClick: Function.prototype,
|
|
103
104
|
position: null
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
|
|
4
|
+
var generateStyle = function generateStyle(componentTheme, props) {
|
|
5
|
+
var printMq = '@media print';
|
|
6
|
+
return {
|
|
7
|
+
newItemButton: _objectSpread({
|
|
8
|
+
border: 'none',
|
|
9
|
+
margin: componentTheme.newItemButtonMargin,
|
|
10
|
+
padding: componentTheme.newItemButtonPadding,
|
|
11
|
+
backgroundColor: componentTheme.newItemButtonBackgroundColor,
|
|
12
|
+
borderRadius: componentTheme.newItemButtonBorderRadius,
|
|
13
|
+
lineHeight: 0,
|
|
14
|
+
fontSize: componentTheme.newItemButtonFontSize,
|
|
15
|
+
fontWeight: componentTheme.newItemButtonFontWeight,
|
|
16
|
+
textAlign: 'center',
|
|
17
|
+
color: componentTheme.newItemButtonColor,
|
|
18
|
+
boxShadow: componentTheme.newItemButtonBoxShadow,
|
|
19
|
+
transform: 'rotate(0deg)',
|
|
20
|
+
transition: componentTheme.newItemButtonTransition,
|
|
21
|
+
zIndex: componentTheme.newItemButtonZIndex,
|
|
22
|
+
':focus': {
|
|
23
|
+
outline: componentTheme.newItemButtonFocusOutline,
|
|
24
|
+
outlineOffset: componentTheme.newItemButtonFocusOutlineOffset
|
|
25
|
+
}
|
|
26
|
+
}, props.isEditing && {
|
|
27
|
+
backgroundColor: componentTheme.newItemButtonEditingBackgroundColor,
|
|
28
|
+
transform: 'rotate(45deg)',
|
|
29
|
+
transition: componentTheme.newItemButtonTransition
|
|
30
|
+
}),
|
|
31
|
+
newItemButtonHolder: _defineProperty({
|
|
32
|
+
display: 'flex',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
width: '100%',
|
|
35
|
+
zIndex: componentTheme.newItemButtonHolderZIndex,
|
|
36
|
+
marginTop: '-1.5rem'
|
|
37
|
+
}, printMq, {
|
|
38
|
+
display: 'none'
|
|
39
|
+
}),
|
|
40
|
+
attachQuestionButtonHolder: _defineProperty({
|
|
41
|
+
display: 'flex',
|
|
42
|
+
justifyContent: 'center',
|
|
43
|
+
width: '100%',
|
|
44
|
+
zIndex: componentTheme.attachQuestionButtonHolderZIndex
|
|
45
|
+
}, printMq, {
|
|
46
|
+
display: 'none'
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var spacing = _ref.spacing,
|
|
3
3
|
colors = _ref.colors,
|
|
4
4
|
borders = _ref.borders,
|
|
@@ -21,4 +21,6 @@ export default function generator(_ref) {
|
|
|
21
21
|
newItemButtonHolderZIndex: '2222',
|
|
22
22
|
newItemButtonTransition: "background-color ".concat(transitions.duration, " linear, transform ").concat(transitions.duration, " ease")
|
|
23
23
|
};
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default generateComponentTheme;
|
|
@@ -5,27 +5,20 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
|
5
5
|
|
|
6
6
|
var _dec, _class, _class2, _temp;
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** @jsx jsx */
|
|
9
|
+
import { Component } from 'react';
|
|
9
10
|
import PropTypes from 'prop-types';
|
|
10
11
|
import { Popover } from '@instructure/ui-popover';
|
|
11
|
-
import {
|
|
12
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
12
13
|
import CustomPropTypes from "../../../../../util/CustomPropTypes.js";
|
|
13
14
|
import elementsForSelectors from "../../../../../util/ElementsForSelectors.js";
|
|
14
15
|
import { onPhone, onTablet } from "../../../../../util/windowChecks.js";
|
|
15
16
|
import AddContentButton from "../Button/index.js";
|
|
16
17
|
import AddContentBody from "../Body/index.js";
|
|
17
18
|
import { DELETED_QUIZ_ENTRY } from '@instructure/quiz-common';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return "\n\n.bgZYv_NbWo{height:1px;position:relative}\n\n.bgZYv_NbWo,.bgZYv_ljGg{align-items:center;display:flex;flex-wrap:wrap;justify-content:center;width:100%}\n\nbody.tox-fullscreen .bgZYv_NbWo,body.tox-fullscreen .bgZYv_ljGg{z-index:0}\n\n.bgZYv_bRWN{border-bottom:solid ".concat(theme.borderLineBorderWidth || 'inherit', " ").concat(theme.borderLineBorderColor || 'inherit', ";top:0;width:100%}");
|
|
22
|
-
},
|
|
23
|
-
'addContentContainer': 'bgZYv_NbWo',
|
|
24
|
-
'attachQuestionContainer': 'bgZYv_ljGg',
|
|
25
|
-
'borderLine': 'bgZYv_bRWN'
|
|
26
|
-
};
|
|
27
|
-
import theme from "./theme.js";
|
|
28
|
-
export var AddContentPopover = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
19
|
+
import generateStyle from "./styles.js";
|
|
20
|
+
import generateComponentTheme from "./theme.js";
|
|
21
|
+
export var AddContentPopover = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
29
22
|
_inherits(AddContentPopover, _Component);
|
|
30
23
|
|
|
31
24
|
var _super = _createSuper(AddContentPopover);
|
|
@@ -58,7 +51,7 @@ export var AddContentPopover = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
58
51
|
};
|
|
59
52
|
|
|
60
53
|
_this.renderPopoverButton = function () {
|
|
61
|
-
return
|
|
54
|
+
return jsx(Popover, {
|
|
62
55
|
on: "click",
|
|
63
56
|
onShowContent: _this.showContent,
|
|
64
57
|
onHideContent: _this.hideContent,
|
|
@@ -66,7 +59,7 @@ export var AddContentPopover = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
66
59
|
shouldCloseOnEscape: true,
|
|
67
60
|
shouldContainFocus: true,
|
|
68
61
|
renderTrigger: _this.renderAddContentButton()
|
|
69
|
-
},
|
|
62
|
+
}, jsx(AddContentBody, {
|
|
70
63
|
allowStimulusCreation: _this.props.allowStimulusCreation,
|
|
71
64
|
onOpenBankTray: _this.props.switchOffEditing,
|
|
72
65
|
onAddItem: _this.props.switchOffEditing,
|
|
@@ -107,7 +100,7 @@ export var AddContentPopover = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
107
100
|
key: "renderAddContentButton",
|
|
108
101
|
value: function renderAddContentButton() {
|
|
109
102
|
var onClick = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
110
|
-
return
|
|
103
|
+
return jsx(AddContentButton, {
|
|
111
104
|
ref: this.storePopoverTriggerRef,
|
|
112
105
|
onClick: onClick,
|
|
113
106
|
isEditing: this.props.isEditing,
|
|
@@ -122,13 +115,12 @@ export var AddContentPopover = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
122
115
|
}, {
|
|
123
116
|
key: "render",
|
|
124
117
|
value: function render() {
|
|
125
|
-
var borderLine = this.props.useStimulusTrigger ? null :
|
|
126
|
-
|
|
118
|
+
var borderLine = this.props.useStimulusTrigger ? null : jsx("div", {
|
|
119
|
+
css: this.props.styles.borderLine
|
|
127
120
|
});
|
|
128
|
-
var wrapperClass = this.props.useStimulusTrigger ? styles.attachQuestionContainer : styles.addContentContainer;
|
|
129
121
|
var button = this.props.isMobile ? this.renderModalButton() : this.renderPopoverButton();
|
|
130
|
-
return
|
|
131
|
-
|
|
122
|
+
return jsx("div", {
|
|
123
|
+
css: this.props.styles.wrapper,
|
|
132
124
|
"data-automation": "sdk-build-add-content"
|
|
133
125
|
}, borderLine, button);
|
|
134
126
|
}
|
|
@@ -150,7 +142,9 @@ export var AddContentPopover = (_dec = themeable(theme, styles), _dec(_class = (
|
|
|
150
142
|
stimulusId: PropTypes.string,
|
|
151
143
|
switchOffEditing: PropTypes.func.isRequired,
|
|
152
144
|
switchOnEditing: PropTypes.func.isRequired,
|
|
153
|
-
useStimulusTrigger: PropTypes.bool
|
|
145
|
+
useStimulusTrigger: PropTypes.bool,
|
|
146
|
+
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
147
|
+
styles: PropTypes.object
|
|
154
148
|
}, _class2.defaultProps = {
|
|
155
149
|
allowStimulusCreation: true,
|
|
156
150
|
isMobile: onPhone() || onTablet(),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme, props) {
|
|
2
|
+
var attachQuestionContainer = {
|
|
3
|
+
width: '100%',
|
|
4
|
+
display: 'flex',
|
|
5
|
+
justifyContent: 'center',
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
flexWrap: 'wrap'
|
|
8
|
+
};
|
|
9
|
+
var addContentContainer = {
|
|
10
|
+
width: '100%',
|
|
11
|
+
display: 'flex',
|
|
12
|
+
justifyContent: 'center',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
flexWrap: 'wrap',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
height: '1px'
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
wrapper: props.useStimulusTrigger ? attachQuestionContainer : addContentContainer,
|
|
20
|
+
borderLine: {
|
|
21
|
+
top: 0,
|
|
22
|
+
width: '100%',
|
|
23
|
+
borderBottom: "solid ".concat(componentTheme.borderLineBorderWidth, " ").concat(componentTheme.borderLineBorderColor)
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default generateStyle;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var colors = _ref.colors,
|
|
3
3
|
borders = _ref.borders;
|
|
4
4
|
return {
|
|
5
5
|
borderLineBorderWidth: borders.widthMedium,
|
|
6
6
|
borderLineBorderColor: colors.porcelain
|
|
7
7
|
};
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default generateComponentTheme;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -17,7 +15,7 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
15
|
|
|
18
16
|
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
19
17
|
|
|
20
|
-
var _react =
|
|
18
|
+
var _react = require("react");
|
|
21
19
|
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
21
|
|
|
@@ -25,21 +23,15 @@ var _uiHeading = require("@instructure/ui-heading");
|
|
|
25
23
|
|
|
26
24
|
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
27
25
|
|
|
28
|
-
var
|
|
26
|
+
var _emotion = require("@instructure/emotion");
|
|
27
|
+
|
|
28
|
+
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
29
29
|
|
|
30
30
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
31
31
|
|
|
32
32
|
var _dec, _class, _class2, _temp;
|
|
33
33
|
|
|
34
|
-
var
|
|
35
|
-
componentId: 'kJotW',
|
|
36
|
-
template: function template(theme) {
|
|
37
|
-
return "\n\n.kJotW_cESy{align-items:center;background-color:".concat(theme.positionBackgroundColor || 'inherit', ";display:flex;height:").concat(theme.positionDimension || 'inherit', ";justify-content:center;margin-left:-1.2rem;margin-right:").concat(theme.positionMargin || 'inherit', ";min-width:").concat(theme.positionDimension || 'inherit', ";padding:0 ").concat(theme.positionPadding || 'inherit', ";z-index:").concat(theme.positionZIndex || 'inherit', "}\n\nbody.tox-fullscreen .kJotW_cESy{z-index:0}\n\n.kJotW_bUkG{color:").concat(theme.positionTextColor || 'inherit', ";font-size:").concat(theme.positionTextFontSize || 'inherit', "}\n\n@media print{.kJotW_cESy{-webkit-print-color-adjust:exact;color-adjust:exact}}");
|
|
38
|
-
},
|
|
39
|
-
'position': 'kJotW_cESy',
|
|
40
|
-
'positionText': 'kJotW_bUkG'
|
|
41
|
-
};
|
|
42
|
-
var PositionBox = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
34
|
+
var PositionBox = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
43
35
|
(0, _inherits2.default)(PositionBox, _Component);
|
|
44
36
|
|
|
45
37
|
var _super = (0, _createSuper2.default)(PositionBox);
|
|
@@ -52,16 +44,16 @@ var PositionBox = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _
|
|
|
52
44
|
(0, _createClass2.default)(PositionBox, [{
|
|
53
45
|
key: "render",
|
|
54
46
|
value: function render() {
|
|
55
|
-
return
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
47
|
+
return (0, _emotion.jsx)("div", {
|
|
48
|
+
css: this.props.styles.position
|
|
49
|
+
}, (0, _emotion.jsx)("div", {
|
|
50
|
+
css: this.props.styles.positionText,
|
|
59
51
|
"data-automation": "sdk-position-box-text"
|
|
60
|
-
},
|
|
52
|
+
}, (0, _emotion.jsx)(_uiA11yContent.ScreenReaderContent, {
|
|
61
53
|
as: "div"
|
|
62
|
-
},
|
|
54
|
+
}, (0, _emotion.jsx)(_uiHeading.Heading, {
|
|
63
55
|
level: this.props.headingLevel
|
|
64
|
-
}, this.props.headingText)),
|
|
56
|
+
}, this.props.headingText)), (0, _emotion.jsx)(_uiA11yContent.PresentationContent, null, this.props.position)));
|
|
65
57
|
}
|
|
66
58
|
}]);
|
|
67
59
|
PositionBox.displayName = "PositionBox";
|
|
@@ -69,7 +61,9 @@ var PositionBox = (_dec = (0, _uiThemeable.themeable)(_theme.default, styles), _
|
|
|
69
61
|
}(_react.Component), _class2.propTypes = {
|
|
70
62
|
headingText: _propTypes.default.string.isRequired,
|
|
71
63
|
headingLevel: _propTypes.default.string,
|
|
72
|
-
position: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired
|
|
64
|
+
position: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
65
|
+
// eslint-disable-next-line react/require-default-props,react/forbid-prop-types
|
|
66
|
+
styles: _propTypes.default.object
|
|
73
67
|
}, _class2.defaultProps = {
|
|
74
68
|
headingLevel: 'h2'
|
|
75
69
|
}, _temp)) || _class);
|