@instructure/quiz-core 20.9.0 → 20.9.1-rc.0
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/building/components/layout/Sidebar/SidebarItem/presenter.js +16 -22
- package/es/building/components/layout/Sidebar/SidebarItem/styles.js +11 -0
- package/es/building/components/layout/Sidebar/SidebarItem/theme.js +4 -2
- package/es/building/components/layout/Sidebar/Stimulus/presenter.js +17 -23
- package/es/building/components/layout/Sidebar/Stimulus/styles.js +11 -0
- package/es/building/components/layout/Sidebar/Stimulus/theme.js +4 -2
- package/es/building/components/layout/Sidebar/presenter.js +42 -38
- package/es/building/components/layout/Sidebar/styles.js +28 -0
- package/es/building/components/layout/Sidebar/theme.js +4 -2
- package/es/building/components/layout/header/BuildingButtons/presenter.js +33 -39
- package/es/building/components/layout/header/BuildingButtons/styles.js +21 -0
- package/es/building/components/layout/header/BuildingButtons/theme.js +4 -2
- package/es/building/components/resources/ActionButtons/presenter.js +29 -27
- package/es/building/components/resources/ActionButtons/styles.js +33 -0
- package/es/building/components/resources/ActionButtons/theme.js +4 -2
- package/es/building/components/resources/AddToBankOptions/index.js +11 -15
- package/es/building/components/resources/AddToBankOptions/styles.js +11 -0
- package/es/building/components/resources/AddToBankOptions/theme.js +4 -2
- package/es/building/components/resources/DeleteStimulusModal/presenter.js +38 -44
- package/es/building/components/resources/DeleteStimulusModal/styles.js +22 -0
- package/es/building/components/resources/DeleteStimulusModal/theme.js +4 -2
- package/es/building/components/resources/ItemFeedbackModal/presenter.js +23 -28
- package/es/building/components/resources/ItemFeedbackModal/styles.js +14 -0
- package/es/building/components/resources/ItemFeedbackModal/theme.js +4 -2
- package/es/common/components/layout/sidebar/PositionSummary/index.js +17 -25
- package/es/common/components/layout/sidebar/PositionSummary/styles.js +28 -0
- package/es/common/components/layout/sidebar/PositionSummary/theme.js +4 -2
- package/es/common/components/layout/sidebar/Sidebar/index.js +88 -94
- package/es/common/components/layout/sidebar/Sidebar/styles.js +117 -0
- package/es/common/components/layout/sidebar/Sidebar/theme.js +4 -8
- package/es/common/components/layout/sidebar/SidebarItem/presenter.js +52 -52
- package/es/common/components/layout/sidebar/SidebarItem/styles.js +59 -0
- package/es/common/components/layout/sidebar/SidebarItem/theme.js +4 -2
- package/es/common/components/layout/sidebar/Stimulus/presenter.js +39 -36
- package/es/common/components/layout/sidebar/Stimulus/styles.js +33 -0
- package/es/common/components/layout/sidebar/Stimulus/theme.js +4 -2
- package/es/common/components/shared/drag_and_drop/DragAndDropZone/index.js +40 -30
- package/es/common/components/shared/drag_and_drop/DragAndDropZone/styles.js +41 -0
- package/es/common/components/shared/drag_and_drop/DragAndDropZone/theme.js +4 -2
- package/lib/building/components/layout/Sidebar/SidebarItem/presenter.js +15 -23
- package/lib/building/components/layout/Sidebar/SidebarItem/styles.js +19 -0
- package/lib/building/components/layout/Sidebar/SidebarItem/theme.js +6 -3
- package/lib/building/components/layout/Sidebar/Stimulus/presenter.js +16 -24
- package/lib/building/components/layout/Sidebar/Stimulus/styles.js +19 -0
- package/lib/building/components/layout/Sidebar/Stimulus/theme.js +6 -3
- package/lib/building/components/layout/Sidebar/presenter.js +40 -41
- package/lib/building/components/layout/Sidebar/styles.js +38 -0
- package/lib/building/components/layout/Sidebar/theme.js +6 -3
- package/lib/building/components/layout/header/BuildingButtons/presenter.js +32 -40
- package/lib/building/components/layout/header/BuildingButtons/styles.js +29 -0
- package/lib/building/components/layout/header/BuildingButtons/theme.js +6 -3
- package/lib/building/components/resources/ActionButtons/presenter.js +28 -30
- package/lib/building/components/resources/ActionButtons/styles.js +44 -0
- package/lib/building/components/resources/ActionButtons/theme.js +6 -3
- package/lib/building/components/resources/AddToBankOptions/index.js +10 -16
- package/lib/building/components/resources/AddToBankOptions/styles.js +19 -0
- package/lib/building/components/resources/AddToBankOptions/theme.js +6 -3
- package/lib/building/components/resources/DeleteStimulusModal/presenter.js +37 -46
- package/lib/building/components/resources/DeleteStimulusModal/styles.js +30 -0
- package/lib/building/components/resources/DeleteStimulusModal/theme.js +6 -3
- package/lib/building/components/resources/ItemFeedbackModal/presenter.js +19 -27
- package/lib/building/components/resources/ItemFeedbackModal/styles.js +22 -0
- package/lib/building/components/resources/ItemFeedbackModal/theme.js +6 -3
- package/lib/common/components/layout/sidebar/PositionSummary/index.js +16 -26
- package/lib/common/components/layout/sidebar/PositionSummary/styles.js +36 -0
- package/lib/common/components/layout/sidebar/PositionSummary/theme.js +6 -3
- package/lib/common/components/layout/sidebar/Sidebar/index.js +85 -97
- package/lib/common/components/layout/sidebar/Sidebar/styles.js +128 -0
- package/lib/common/components/layout/sidebar/Sidebar/theme.js +5 -9
- package/lib/common/components/layout/sidebar/SidebarItem/presenter.js +51 -55
- package/lib/common/components/layout/sidebar/SidebarItem/styles.js +69 -0
- package/lib/common/components/layout/sidebar/SidebarItem/theme.js +6 -3
- package/lib/common/components/layout/sidebar/Stimulus/presenter.js +38 -37
- package/lib/common/components/layout/sidebar/Stimulus/styles.js +41 -0
- package/lib/common/components/layout/sidebar/Stimulus/theme.js +6 -3
- package/lib/common/components/shared/drag_and_drop/DragAndDropZone/index.js +40 -33
- package/lib/common/components/shared/drag_and_drop/DragAndDropZone/styles.js +51 -0
- package/lib/common/components/shared/drag_and_drop/DragAndDropZone/theme.js +6 -3
- package/package.json +10 -10
|
@@ -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,36 +5,20 @@ 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
11
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
|
12
|
-
import classNames from 'classnames';
|
|
13
12
|
import { AccessibleContent } from '@instructure/ui-a11y-content';
|
|
14
13
|
import { Link } from '@instructure/ui-link';
|
|
15
14
|
import { Flex } from '@instructure/ui-flex';
|
|
16
|
-
import {
|
|
15
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
17
16
|
import PositionSummary from "../PositionSummary/index.js";
|
|
18
17
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
19
18
|
import { RichContentRenderer } from '@instructure/quiz-rce';
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return "\n\n.cwwgG_kQJA{border-bottom:".concat(theme.bottomBorderWidth || 'inherit', " solid ").concat(theme.bottomBorderColor || 'inherit', ";border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.borderColor || 'inherit', "}\n\n.cwwgG_kQJA:hover{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.hoverBorderColor || 'inherit', "}\n\n.cwwgG_cdGL{color:").concat(theme.infoHeaderColor || 'inherit', ";display:flex;font-size:").concat(theme.infoHeaderFontSize || 'inherit', "}\n\n.cwwgG_ecuB{width:60%}\n\n.cwwgG_echV{width:40%}\n\n.cwwgG_doeu{font-size:").concat(theme.numberFontSize || 'inherit', ";font-weight:").concat(theme.numberFontWeight || 'inherit', "}\n\n.cwwgG_doeu,.cwwgG_esVF{color:").concat(theme.darkTextColor || 'inherit', "}\n\n.cwwgG_esVF{font-size:").concat(theme.itemBodyFontSize || 'inherit', ";margin-top:").concat(theme.itemBodyMarginTop || 'inherit', ";overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n\n.cwwgG_fBqo{cursor:pointer;position:relative}\n\n.cwwgG_eQGE{margin:0 ").concat(theme.sidebarClosedMargin || 'inherit', ";padding:").concat(theme.sidebarClosedPadding || 'inherit', " 0;text-align:center}\n\n[dir=ltr] .cwwgG_eQGE,[dir=rtl] .cwwgG_eQGE{text-align:center}\n\n.cwwgG_csre{display:flex;justify-content:flex-end}\n\n.cwwgG_cRFW{border-bottom:none}\n\n.cwwgG_eNNp{padding:").concat(theme.sidebarIsOpenPadding || 'inherit', "}\n\n.cwwgG_eNNp.cwwgG_cRFW{margin-left:10%}\n\n.cwwgG_eNNp .cwwgG_fBqo{font-size:").concat(theme.sidebarIsOpenMainTextFontSize || 'inherit', ";margin-top:").concat(theme.mainTextPaddingTop || 'inherit', "}");
|
|
24
|
-
},
|
|
25
|
-
'sidebarItem': 'cwwgG_kQJA',
|
|
26
|
-
'infoHeader': 'cwwgG_cdGL',
|
|
27
|
-
'interactionType': 'cwwgG_ecuB',
|
|
28
|
-
'pointsPossible': 'cwwgG_echV',
|
|
29
|
-
'displayNumber': 'cwwgG_doeu',
|
|
30
|
-
'itemBody': 'cwwgG_esVF',
|
|
31
|
-
'mainText': 'cwwgG_fBqo',
|
|
32
|
-
'sidebarClosed': 'cwwgG_eQGE',
|
|
33
|
-
'pinWrapper': 'cwwgG_csre',
|
|
34
|
-
'inStimulus': 'cwwgG_cRFW',
|
|
35
|
-
'sidebarIsOpen': 'cwwgG_eNNp'
|
|
36
|
-
};
|
|
37
|
-
import theme from "./theme.js";
|
|
38
|
-
export var SidebarItem = (_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 SidebarItem = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
39
22
|
_inherits(SidebarItem, _Component);
|
|
40
23
|
|
|
41
24
|
var _super = _createSuper(SidebarItem);
|
|
@@ -69,6 +52,19 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
69
52
|
}
|
|
70
53
|
|
|
71
54
|
_createClass(SidebarItem, [{
|
|
55
|
+
key: "componentDidMount",
|
|
56
|
+
value: function componentDidMount() {
|
|
57
|
+
this.props.makeStyles();
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "componentDidUpdate",
|
|
61
|
+
value: function componentDidUpdate() {
|
|
62
|
+
this.props.makeStyles();
|
|
63
|
+
} // ============
|
|
64
|
+
// ACTIONS
|
|
65
|
+
// ============
|
|
66
|
+
|
|
67
|
+
}, {
|
|
72
68
|
key: "getPointsText",
|
|
73
69
|
// ============
|
|
74
70
|
// HELPERS
|
|
@@ -91,14 +87,14 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
91
87
|
sidebarOpen = _this$props.sidebarOpen;
|
|
92
88
|
|
|
93
89
|
if (!sidebarOpen && quizEntry && quizEntry.sizeOfBank > 1) {
|
|
94
|
-
return
|
|
90
|
+
return jsx(PositionSummary, {
|
|
95
91
|
firstPosition: position,
|
|
96
92
|
lastPosition: position + quizEntry.sizeOfBank - 1
|
|
97
93
|
});
|
|
98
94
|
}
|
|
99
95
|
|
|
100
|
-
return
|
|
101
|
-
|
|
96
|
+
return jsx("span", {
|
|
97
|
+
css: this.props.styles.displayNumber
|
|
102
98
|
}, displayPosition);
|
|
103
99
|
}
|
|
104
100
|
}, {
|
|
@@ -113,7 +109,7 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
113
109
|
}) : t('Navigate to question at position {displayPosition}', {
|
|
114
110
|
displayPosition: displayPosition
|
|
115
111
|
});
|
|
116
|
-
return
|
|
112
|
+
return jsx(Link, {
|
|
117
113
|
href: "#",
|
|
118
114
|
size: "small",
|
|
119
115
|
margin: "0 small",
|
|
@@ -122,16 +118,15 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
122
118
|
onClick: this.scrollToItem,
|
|
123
119
|
"data-automation-item-id": itemId,
|
|
124
120
|
"data-automation": "sdk-sidebar-item-button"
|
|
125
|
-
},
|
|
121
|
+
}, jsx(AccessibleContent, {
|
|
126
122
|
alt: screenReaderContent
|
|
127
123
|
}, this.renderPosition()));
|
|
128
124
|
}
|
|
129
125
|
}, {
|
|
130
126
|
key: "renderClosed",
|
|
131
127
|
value: function renderClosed() {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
className: contentWrapperClasses
|
|
128
|
+
return jsx("div", {
|
|
129
|
+
css: this.props.styles.sidebarItem
|
|
135
130
|
}, this.renderButton());
|
|
136
131
|
}
|
|
137
132
|
}, {
|
|
@@ -140,32 +135,34 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
140
135
|
var _this$props3 = this.props,
|
|
141
136
|
children = _this$props3.children,
|
|
142
137
|
itemName = _this$props3.itemName,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
},
|
|
138
|
+
pointsPossible = _this$props3.pointsPossible,
|
|
139
|
+
styles = _this$props3.styles;
|
|
140
|
+
return jsx("div", {
|
|
141
|
+
className: "sidebarIsOpen",
|
|
142
|
+
css: styles.sidebarItem
|
|
143
|
+
}, jsx(Flex, {
|
|
149
144
|
justifyItems: "space-between"
|
|
150
|
-
},
|
|
145
|
+
}, jsx(Flex.Item, null, this.renderButton()), jsx(Flex.Item, {
|
|
151
146
|
shouldGrow: true,
|
|
152
147
|
shouldShrink: true,
|
|
153
148
|
onClick: this.scrollToItem,
|
|
154
149
|
tabIndex: "-1"
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
},
|
|
160
|
-
className:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
},
|
|
150
|
+
}, jsx("div", {
|
|
151
|
+
css: this.props.styles.mainText
|
|
152
|
+
}, jsx("div", {
|
|
153
|
+
css: this.props.styles.infoHeader
|
|
154
|
+
}, jsx("div", {
|
|
155
|
+
className: "interactionType",
|
|
156
|
+
css: this.props.styles.interactionType
|
|
157
|
+
}, itemName), jsx("div", {
|
|
158
|
+
className: "pointsPossible",
|
|
159
|
+
css: this.props.styles.pointsPossible
|
|
160
|
+
}, this.getPointsText(pointsPossible || 0))), jsx("div", {
|
|
161
|
+
css: this.props.styles.itemBody
|
|
162
|
+
}, jsx(RichContentRenderer, {
|
|
166
163
|
content: this.props.itemBody
|
|
167
|
-
})))),
|
|
168
|
-
|
|
164
|
+
})))), jsx(Flex.Item, null, jsx("div", {
|
|
165
|
+
css: this.props.styles.pinWrapper
|
|
169
166
|
}, children))));
|
|
170
167
|
}
|
|
171
168
|
}, {
|
|
@@ -184,6 +181,7 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
184
181
|
itemId: PropTypes.string.isRequired,
|
|
185
182
|
itemBody: PropTypes.string,
|
|
186
183
|
itemName: PropTypes.string.isRequired,
|
|
184
|
+
// eslint-disable-next-line react/no-unused-prop-types
|
|
187
185
|
inStimulus: PropTypes.bool,
|
|
188
186
|
isAnswered: PropTypes.bool,
|
|
189
187
|
position: PropTypes.number.isRequired,
|
|
@@ -193,7 +191,9 @@ export var SidebarItem = (_dec = themeable(theme, styles), _dec(_class = (_temp
|
|
|
193
191
|
// not used on Take
|
|
194
192
|
sidebarOpen: PropTypes.bool.isRequired,
|
|
195
193
|
// from connect
|
|
196
|
-
scrollToItem: PropTypes.func.isRequired
|
|
194
|
+
scrollToItem: PropTypes.func.isRequired,
|
|
195
|
+
styles: PropTypes.object,
|
|
196
|
+
makeStyles: PropTypes.func
|
|
197
197
|
}, _class2.defaultProps = {
|
|
198
198
|
children: null,
|
|
199
199
|
inStimulus: false,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
|
|
3
|
+
var generateStyle = function generateStyle(componentTheme, props) {
|
|
4
|
+
return {
|
|
5
|
+
sidebarItem: _objectSpread(_objectSpread(_objectSpread({
|
|
6
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
|
|
7
|
+
borderBottom: "".concat(componentTheme.bottomBorderWidth, " solid ").concat(componentTheme.bottomBorderColor),
|
|
8
|
+
'&:hover': {
|
|
9
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
|
|
10
|
+
},
|
|
11
|
+
padding: componentTheme.sidebarIsOpenPadding
|
|
12
|
+
}, props.inStimulus && {
|
|
13
|
+
borderBottom: 'none'
|
|
14
|
+
}), props.sidebarOpen && props.inStimulus && {
|
|
15
|
+
marginLeft: '10%'
|
|
16
|
+
}), !props.sidebarOpen && {
|
|
17
|
+
padding: "".concat(componentTheme.sidebarClosedPadding, " 0"),
|
|
18
|
+
margin: "0 ".concat(componentTheme.sidebarClosedMargin),
|
|
19
|
+
textAlign: 'center'
|
|
20
|
+
}),
|
|
21
|
+
infoHeader: {
|
|
22
|
+
fontSize: componentTheme.infoHeaderFontSize,
|
|
23
|
+
display: 'flex',
|
|
24
|
+
color: componentTheme.infoHeaderColor
|
|
25
|
+
},
|
|
26
|
+
interactionType: {
|
|
27
|
+
width: '60%'
|
|
28
|
+
},
|
|
29
|
+
pointsPossible: {
|
|
30
|
+
width: '40%'
|
|
31
|
+
},
|
|
32
|
+
displayNumber: {
|
|
33
|
+
color: componentTheme.darkTextColor,
|
|
34
|
+
fontSize: componentTheme.numberFontSize,
|
|
35
|
+
fontWeight: componentTheme.numberFontWeight
|
|
36
|
+
},
|
|
37
|
+
itemBody: {
|
|
38
|
+
fontSize: componentTheme.itemBodyFontSize,
|
|
39
|
+
color: componentTheme.darkTextColor,
|
|
40
|
+
whiteSpace: 'nowrap',
|
|
41
|
+
textOverflow: 'ellipsis',
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
marginTop: componentTheme.itemBodyMarginTop
|
|
44
|
+
},
|
|
45
|
+
mainText: _objectSpread({
|
|
46
|
+
position: 'relative',
|
|
47
|
+
cursor: 'pointer'
|
|
48
|
+
}, props.sidebarOpen && {
|
|
49
|
+
fontSize: componentTheme.sidebarIsOpenMainTextFontSize,
|
|
50
|
+
marginTop: componentTheme.mainTextPaddingTop
|
|
51
|
+
}),
|
|
52
|
+
pinWrapper: {
|
|
53
|
+
display: 'flex',
|
|
54
|
+
justifyContent: 'flex-end'
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var borders = _ref.borders,
|
|
3
3
|
colors = _ref.colors,
|
|
4
4
|
typography = _ref.typography,
|
|
@@ -23,4 +23,6 @@ export default function generator(_ref) {
|
|
|
23
23
|
sidebarIsOpenPadding: "".concat(spacing.small, " 0 ").concat(spacing.medium, " 0"),
|
|
24
24
|
sidebarItemLogoFontSize: typography.fontSizeMedium
|
|
25
25
|
};
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default generateComponentTheme;
|
|
@@ -5,37 +5,28 @@ 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 { IconTextLeftLine } from '@instructure/ui-icons';
|
|
12
|
-
import {
|
|
13
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
13
14
|
import { Link } from '@instructure/ui-link';
|
|
14
15
|
import { Flex } from '@instructure/ui-flex';
|
|
15
16
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
16
17
|
import Collection from "./Collection/index.js";
|
|
17
18
|
import Title from "./Title/index.js";
|
|
18
19
|
import Summary from "./Summary/index.js";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
template: function template(theme) {
|
|
22
|
-
return "\n\n.cqghd_kQJA{border-bottom:".concat(theme.sidebarItemBorderWidth || 'inherit', " solid ").concat(theme.sidebarItemBorderColor || 'inherit', "}\n\n.cqghd_cESm{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.borderColor || 'inherit', ";padding:").concat(theme.sidebarClosedButtonPadding || 'inherit', ";text-align:center}\n\n[dir=ltr] .cqghd_cESm,[dir=rtl] .cqghd_cESm{text-align:center}\n\n.cqghd_cESm:hover{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.hoverBorderColor || 'inherit', "}\n\n.cqghd_faDl{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.borderColor || 'inherit', ";padding:").concat(theme.sidebarHeaderPadding || 'inherit', " 0}\n\n.cqghd_faDl:hover{border-right:").concat(theme.hoverBorderWidth || 'inherit', " solid ").concat(theme.hoverBorderColor || 'inherit', "}\n\n.cqghd_bTns{margin-left:5%}\n\n.cqghd_cdGL{color:").concat(theme.sidebarIsOpenInfoHeaderColor || 'inherit', ";font-size:").concat(theme.sidebarIsOpenInfoHeaderFontSize || 'inherit', ";margin-bottom:").concat(theme.sidebarIsOpenInfoHeaderMargin || 'inherit', ";padding-left:").concat(theme.sidebarIsOpenInfoHeaderPadding || 'inherit', "}");
|
|
23
|
-
},
|
|
24
|
-
'sidebarItem': 'cqghd_kQJA',
|
|
25
|
-
'sidebarItemClosedButton': 'cqghd_cESm',
|
|
26
|
-
'stimulusHeader': 'cqghd_faDl',
|
|
27
|
-
'stimulusBody': 'cqghd_bTns',
|
|
28
|
-
'infoHeader': 'cqghd_cdGL'
|
|
29
|
-
};
|
|
30
|
-
import theme from "./theme.js";
|
|
20
|
+
import generateStyle from "./styles.js";
|
|
21
|
+
import generateComponentTheme from "./theme.js";
|
|
31
22
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
32
23
|
export var DISPLAY_AS_SUMMARY_LIMIT = 5;
|
|
33
24
|
|
|
34
|
-
var _ref =
|
|
25
|
+
var _ref = jsx(IconTextLeftLine, {
|
|
35
26
|
color: "primary"
|
|
36
27
|
});
|
|
37
28
|
|
|
38
|
-
export var SidebarStimulus = (_dec =
|
|
29
|
+
export var SidebarStimulus = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
39
30
|
_inherits(SidebarStimulus, _Component);
|
|
40
31
|
|
|
41
32
|
var _super = _createSuper(SidebarStimulus);
|
|
@@ -65,6 +56,16 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
65
56
|
}
|
|
66
57
|
|
|
67
58
|
_createClass(SidebarStimulus, [{
|
|
59
|
+
key: "componentDidMount",
|
|
60
|
+
value: function componentDidMount() {
|
|
61
|
+
this.props.makeStyles();
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
key: "componentDidUpdate",
|
|
65
|
+
value: function componentDidUpdate() {
|
|
66
|
+
this.props.makeStyles();
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
68
69
|
key: "renderCollection",
|
|
69
70
|
value: function renderCollection() {
|
|
70
71
|
if (this.props.isDragging) {
|
|
@@ -77,7 +78,7 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
77
78
|
isShowingItems = _this$props.isShowingItems,
|
|
78
79
|
renderSidebarItem = _this$props.renderSidebarItem,
|
|
79
80
|
sidebarOpen = _this$props.sidebarOpen;
|
|
80
|
-
return
|
|
81
|
+
return jsx(Collection, {
|
|
81
82
|
firstPosition: displayPosition,
|
|
82
83
|
isOver: isOver,
|
|
83
84
|
isShowingItems: isShowingItems,
|
|
@@ -91,23 +92,23 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
91
92
|
key: "renderButton",
|
|
92
93
|
value: function renderButton() {
|
|
93
94
|
var displayPosition = this.props.displayPosition;
|
|
94
|
-
return
|
|
95
|
+
return jsx(Link, {
|
|
95
96
|
href: "#",
|
|
96
97
|
margin: "small",
|
|
97
98
|
forceButtonRole: false,
|
|
98
99
|
onClick: this.scrollToItem,
|
|
99
100
|
renderIcon: _ref
|
|
100
|
-
},
|
|
101
|
+
}, jsx(ScreenReaderContent, null, t('Navigate to stimulus at position { displayPosition }', {
|
|
101
102
|
displayPosition: displayPosition
|
|
102
103
|
})));
|
|
103
104
|
}
|
|
104
105
|
}, {
|
|
105
106
|
key: "renderClosed",
|
|
106
107
|
value: function renderClosed() {
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
|
|
108
|
+
return jsx("div", {
|
|
109
|
+
css: this.props.styles.sidebarItem
|
|
110
|
+
}, jsx("div", {
|
|
111
|
+
css: this.props.styles.sidebarItemClosedButton
|
|
111
112
|
}, this.renderButton()), this.renderCollection());
|
|
112
113
|
}
|
|
113
114
|
}, {
|
|
@@ -120,24 +121,24 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
120
121
|
isShowingItems = _this$props2.isShowingItems,
|
|
121
122
|
sidebarOpen = _this$props2.sidebarOpen,
|
|
122
123
|
stimulus = _this$props2.stimulus;
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
}, t('Stimulus')),
|
|
130
|
-
|
|
131
|
-
},
|
|
124
|
+
return jsx("div", {
|
|
125
|
+
css: this.props.styles.sidebarItem
|
|
126
|
+
}, jsx("div", {
|
|
127
|
+
css: this.props.styles.stimulusHeader
|
|
128
|
+
}, jsx("div", {
|
|
129
|
+
css: this.props.styles.infoHeader
|
|
130
|
+
}, t('Stimulus')), jsx("div", {
|
|
131
|
+
css: this.props.styles.stimulusBody
|
|
132
|
+
}, jsx(Flex, {
|
|
132
133
|
justifyItems: "space-between"
|
|
133
|
-
},
|
|
134
|
+
}, jsx(Flex.Item, null, this.renderButton()), jsx(Flex.Item, {
|
|
134
135
|
shouldGrow: true,
|
|
135
136
|
shouldShrink: true,
|
|
136
137
|
onClick: this.scrollToItem,
|
|
137
138
|
tabIndex: "-1"
|
|
138
|
-
},
|
|
139
|
+
}, jsx(Title, {
|
|
139
140
|
title: stimulus.title
|
|
140
|
-
})),
|
|
141
|
+
})), jsx(Flex.Item, null, children)), jsx(Summary, {
|
|
141
142
|
startPosition: displayPosition,
|
|
142
143
|
isDragging: isDragging,
|
|
143
144
|
isShowingItems: isShowingItems,
|
|
@@ -169,7 +170,9 @@ export var SidebarStimulus = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
169
170
|
scrollToItem: PropTypes.func.isRequired,
|
|
170
171
|
sidebarOpen: PropTypes.bool.isRequired,
|
|
171
172
|
stimulus: ImmutablePropTypes.record.isRequired,
|
|
172
|
-
stimulusParent: ImmutablePropTypes.record.isRequired
|
|
173
|
+
stimulusParent: ImmutablePropTypes.record.isRequired,
|
|
174
|
+
styles: PropTypes.object,
|
|
175
|
+
makeStyles: PropTypes.func
|
|
173
176
|
}, _class2.defaultProps = {
|
|
174
177
|
children: null,
|
|
175
178
|
isDragging: false,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var generateStyle = function generateStyle(componentTheme) {
|
|
2
|
+
return {
|
|
3
|
+
sidebarItem: {
|
|
4
|
+
borderBottom: "".concat(componentTheme.sidebarItemBorderWidth, " solid ").concat(componentTheme.sidebarItemBorderColor)
|
|
5
|
+
},
|
|
6
|
+
sidebarItemClosedButton: {
|
|
7
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
|
|
8
|
+
padding: componentTheme.sidebarClosedButtonPadding,
|
|
9
|
+
textAlign: 'center',
|
|
10
|
+
'&:hover': {
|
|
11
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
stimulusHeader: {
|
|
15
|
+
padding: "".concat(componentTheme.sidebarHeaderPadding, " 0"),
|
|
16
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.borderColor),
|
|
17
|
+
'&:hover:': {
|
|
18
|
+
borderRight: "".concat(componentTheme.hoverBorderWidth, " solid ").concat(componentTheme.hoverBorderColor)
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
stimulusBody: {
|
|
22
|
+
marginLeft: '5%'
|
|
23
|
+
},
|
|
24
|
+
infoHeader: {
|
|
25
|
+
fontSize: componentTheme.sidebarIsOpenInfoHeaderFontSize,
|
|
26
|
+
color: componentTheme.sidebarIsOpenInfoHeaderColor,
|
|
27
|
+
marginBottom: componentTheme.sidebarIsOpenInfoHeaderMargin,
|
|
28
|
+
paddingLeft: componentTheme.sidebarIsOpenInfoHeaderPadding
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default generateStyle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var generateComponentTheme = function generateComponentTheme(_ref) {
|
|
2
2
|
var colors = _ref.colors,
|
|
3
3
|
spacing = _ref.spacing,
|
|
4
4
|
borders = _ref.borders,
|
|
@@ -16,4 +16,6 @@ export default function generator(_ref) {
|
|
|
16
16
|
sidebarIsOpenInfoHeaderMargin: spacing.xSmall,
|
|
17
17
|
sidebarIsOpenInfoHeaderColor: colors.ash
|
|
18
18
|
};
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
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,35 +5,49 @@ 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
|
|
12
|
-
import { themeable } from '@instructure/ui-themeable';
|
|
11
|
+
import { withStyle, jsx } from '@instructure/emotion';
|
|
13
12
|
import t from '@instructure/quiz-i18n/es/format-message';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return "\n\n.cSfbM_ffKt{background-color:".concat(theme.DnDZoneBackgroundColor || 'inherit', ";border:").concat(theme.DnDZoneBorderWidth || 'inherit', " dashed ").concat(theme.DnDZoneBorderColor || 'inherit', ";display:flex;padding:").concat(theme.DnDZonePadding || 'inherit', "}\n\n.cSfbM_ffKt,.cSfbM_dDZW{justify-content:center;width:100%}\n\n.cSfbM_dDZW{background-color:").concat(theme.sidebarDnDZoneBackgroundColor || 'inherit', ";border:").concat(theme.sidebarDnDZoneBorderWidth || 'inherit', " dashed ").concat(theme.sidebarDnDZoneBorderColor || 'inherit', ";color:").concat(theme.sidebarDnDZoneColor || 'inherit', ";margin:").concat(theme.sidebarDnDZoneMargin || 'inherit', ";padding:").concat(theme.sidebarDnDZonePadding || 'inherit', ";text-align:center}\n\n[dir=ltr] .cSfbM_dDZW,[dir=rtl] .cSfbM_dDZW{text-align:center}\n\n.cSfbM_dDZW.cSfbM_baAw{margin-left:10%;width:90%}\n\n.cSfbM_gasz{display:flex;flex:1 0 100%;justify-content:center;width:100%}\n\n.cSfbM_bBLs{display:none;width:100%}");
|
|
18
|
-
},
|
|
19
|
-
'DnDZone': 'cSfbM_ffKt',
|
|
20
|
-
'sidebarDnDZone': 'cSfbM_dDZW',
|
|
21
|
-
'inSidebarStimulus': 'cSfbM_baAw',
|
|
22
|
-
'wrapper': 'cSfbM_gasz',
|
|
23
|
-
'hide': 'cSfbM_bBLs'
|
|
24
|
-
};
|
|
25
|
-
import theme from "./theme.js";
|
|
26
|
-
export var DragAndDropZone = (_dec = themeable(theme, styles), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
13
|
+
import generateStyle from "./styles.js";
|
|
14
|
+
import generateComponentTheme from "./theme.js";
|
|
15
|
+
export var DragAndDropZone = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_temp = _class2 = /*#__PURE__*/function (_Component) {
|
|
27
16
|
_inherits(DragAndDropZone, _Component);
|
|
28
17
|
|
|
29
18
|
var _super = _createSuper(DragAndDropZone);
|
|
30
19
|
|
|
31
20
|
function DragAndDropZone() {
|
|
21
|
+
var _this;
|
|
22
|
+
|
|
32
23
|
_classCallCheck(this, DragAndDropZone);
|
|
33
24
|
|
|
34
|
-
|
|
25
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
|
+
args[_key] = arguments[_key];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
30
|
+
_this.state = {
|
|
31
|
+
toRender: false
|
|
32
|
+
};
|
|
33
|
+
return _this;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
_createClass(DragAndDropZone, [{
|
|
37
|
+
key: "componentDidMount",
|
|
38
|
+
value: function componentDidMount() {
|
|
39
|
+
this.props.makeStyles({
|
|
40
|
+
toRender: this.shouldRender()
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, {
|
|
44
|
+
key: "componentDidUpdate",
|
|
45
|
+
value: function componentDidUpdate() {
|
|
46
|
+
this.props.makeStyles({
|
|
47
|
+
toRender: this.shouldRender()
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
38
51
|
key: "shouldRender",
|
|
39
52
|
value: function shouldRender() {
|
|
40
53
|
var _this$props = this.props,
|
|
@@ -69,17 +82,12 @@ export var DragAndDropZone = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
69
82
|
}, {
|
|
70
83
|
key: "render",
|
|
71
84
|
value: function render() {
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var wrapper = classnames(styles.wrapper, _defineProperty({}, styles.hide, !this.shouldRender()));
|
|
79
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
80
|
-
className: wrapper
|
|
81
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
className: style
|
|
85
|
+
var wrapperClass = !this.shouldRender() ? 'wrapper hide' : 'wrapper';
|
|
86
|
+
return jsx("div", {
|
|
87
|
+
className: wrapperClass,
|
|
88
|
+
css: this.props.styles.wrapper
|
|
89
|
+
}, jsx("div", {
|
|
90
|
+
css: this.props.styles.dropZoneStyle
|
|
83
91
|
}, t('Drop Question Here')));
|
|
84
92
|
}
|
|
85
93
|
}]);
|
|
@@ -93,7 +101,9 @@ export var DragAndDropZone = (_dec = themeable(theme, styles), _dec(_class = (_t
|
|
|
93
101
|
inSidebar: PropTypes.bool,
|
|
94
102
|
inStimulus: PropTypes.bool,
|
|
95
103
|
location: PropTypes.oneOf(['above', 'below', 'in']).isRequired,
|
|
96
|
-
sidebarOpen: PropTypes.bool
|
|
104
|
+
sidebarOpen: PropTypes.bool,
|
|
105
|
+
makeStyles: PropTypes.func,
|
|
106
|
+
styles: PropTypes.object
|
|
97
107
|
}, _class2.defaultProps = {
|
|
98
108
|
draggingAboveHalf: false,
|
|
99
109
|
draggingOver: false,
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
|
|
3
|
+
var generateStyle = function generateStyle(componentTheme, props, state) {
|
|
4
|
+
return {
|
|
5
|
+
dropZoneStyle: _objectSpread(_objectSpread(_objectSpread({}, !props.inSidebar && {
|
|
6
|
+
border: "".concat(componentTheme.DnDZoneBorderWidth, " dashed ").concat(componentTheme.DnDZoneBorderColor),
|
|
7
|
+
backgroundColor: componentTheme.DnDZoneBackgroundColor,
|
|
8
|
+
padding: componentTheme.DnDZonePadding,
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
width: '100%'
|
|
12
|
+
}), props.inSidebar && {
|
|
13
|
+
border: "".concat(componentTheme.sidebarDnDZoneBorderWidth, " dashed ").concat(componentTheme.sidebarDnDZoneBorderColor),
|
|
14
|
+
backgroundColor: componentTheme.sidebarDnDZoneBackgroundColor,
|
|
15
|
+
padding: componentTheme.sidebarDnDZonePadding,
|
|
16
|
+
margin: componentTheme.sidebarDnDZoneMargin,
|
|
17
|
+
color: componentTheme.sidebarDnDZoneColor,
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
textAlign: 'center',
|
|
20
|
+
width: '100%',
|
|
21
|
+
'&.inSidebarStimulus': {
|
|
22
|
+
marginLeft: '10%',
|
|
23
|
+
width: '90%'
|
|
24
|
+
}
|
|
25
|
+
}), props.inSidebar && props.inStimulus && {
|
|
26
|
+
marginLeft: '10%',
|
|
27
|
+
width: '90%'
|
|
28
|
+
}),
|
|
29
|
+
wrapper: _objectSpread({
|
|
30
|
+
justifyContent: 'center',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flex: '1 0 100%',
|
|
33
|
+
width: '100%'
|
|
34
|
+
}, !state.toRender && {
|
|
35
|
+
display: 'none',
|
|
36
|
+
width: '100%'
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
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;
|
|
@@ -15,4 +15,6 @@ export default function generator(_ref) {
|
|
|
15
15
|
sidebarDnDZoneMargin: spacing.xSmall,
|
|
16
16
|
sidebarDnDZoneColor: colors.licorice
|
|
17
17
|
};
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default generateComponentTheme;
|