@elice/material-quiz 1.240806.0-pdf.0 → 1.240808.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.
@@ -172,7 +172,6 @@ var MaterialQuizText = function MaterialQuizText(_ref2) {
172
172
  };
173
173
  }();
174
174
  var commonProps = {
175
- type: 'text',
176
175
  autoFocus: answer.length === 0,
177
176
  disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId,
178
177
  placeholder: (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerHint) || intl$1.formatMessage({
@@ -360,6 +360,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
360
360
  handleAnswerReset: handleAnswerReset
361
361
  },
362
362
  children: jsxRuntime.jsxs(QuestionBox.default, {
363
+ titlePrefix: "Q.",
363
364
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
364
365
  onNext: onNext,
365
366
  isNextActive: isNextActive,
@@ -8,6 +8,7 @@ var designTokens = require('@elice/design-tokens');
8
8
  var icons = require('@elice/icons');
9
9
  var markdown = require('@elice/markdown');
10
10
  var styled = require('styled-components');
11
+ var index = require('../../../helpers/index.js');
11
12
  var EbDraggable = require('../../eb-sortable/EbDraggable.js');
12
13
  var MaterialQuizContext = require('../context/MaterialQuizContext.js');
13
14
 
@@ -84,7 +85,7 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
84
85
  children: [isOptionContent ? jsxRuntime.jsx(StyledOptionContent, {
85
86
  vertical: vertical,
86
87
  children: jsxRuntime.jsx(markdown.MarkdownSSR, {
87
- children: (_a = option.options.content) !== null && _a !== void 0 ? _a : '',
88
+ children: (_a = index.addAltTextToImage(option.options)) !== null && _a !== void 0 ? _a : '',
88
89
  paddingx: 0,
89
90
  paddingy: 0,
90
91
  dark: true
@@ -11,6 +11,6 @@ var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
11
11
 
12
12
  var StyledMarkdown = styled__default.default(markdown.Markdown).withConfig({
13
13
  componentId: "sc-l6r531-0"
14
- })(["p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
14
+ })(["& > .elicemd{overflow:hidden;}p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
15
15
 
16
16
  exports.default = StyledMarkdown;
@@ -91,10 +91,10 @@ var QuestionRadioOption = React__default.default.memo(function (_ref6) {
91
91
  onSelect(value);
92
92
  },
93
93
  status: status,
94
+ "aria-checked": selectedValue === value,
94
95
  children: [jsxRuntime.jsx(StyledQuestionRadioInput, {
95
96
  id: value,
96
97
  type: "radio",
97
- readOnly: true,
98
98
  checked: selectedValue === value,
99
99
  status: status
100
100
  }), jsxRuntime.jsx(StyledLabel, {
@@ -1,5 +1,6 @@
1
1
  import type { GetOrgLectureGetResponses, GetOrgMaterialQuizResponseGetResponses } from '@elice/types';
2
2
  import type { QuizOptionType } from '@elice/types/es/enums';
3
+ import type { QuizGroupOption } from "../components/material-quiz/material-quiz-group/context/context";
3
4
  interface OptionInfo {
4
5
  content: string;
5
6
  optionType: QuizOptionType;
@@ -46,4 +47,5 @@ export declare function shouldResetOptions({ materialQuizResponse, }: {
46
47
  materialQuizResponse?: GetOrgMaterialQuizResponseGetResponses['quizResponse'];
47
48
  }): boolean;
48
49
  export declare function getQuizResult(materialQuizResponse: GetOrgMaterialQuizResponseGetResponses['quizResponse']): boolean | undefined;
50
+ export declare const addAltTextToImage: ({ content, title, }: QuizGroupOption['options']) => string | undefined;
49
51
  export {};
@@ -62,7 +62,17 @@ function getQuizResult(materialQuizResponse) {
62
62
  return;
63
63
  }
64
64
  }
65
+ var addAltTextToImage = function addAltTextToImage(_ref3) {
66
+ var content = _ref3.content,
67
+ title = _ref3.title;
68
+ if (!title) return content;
69
+ // Match the pattern ![](<url>)
70
+ var regex = /!\[]\((.*?)\)/;
71
+ // Replace with the alt text inside the []
72
+ return content === null || content === void 0 ? void 0 : content.replace(regex, "![".concat(title, "]($1)"));
73
+ };
65
74
 
75
+ exports.addAltTextToImage = addAltTextToImage;
66
76
  exports.checkUserLectureTestEnded = checkUserLectureTestEnded;
67
77
  exports.getOptionStatus = getOptionStatus;
68
78
  exports.getQuizResult = getQuizResult;
@@ -163,7 +163,6 @@ var MaterialQuizText = function MaterialQuizText(_ref2) {
163
163
  };
164
164
  }();
165
165
  var commonProps = {
166
- type: 'text',
167
166
  autoFocus: answer.length === 0,
168
167
  disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId,
169
168
  placeholder: (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.answerHint) || intl.formatMessage({
@@ -350,6 +350,7 @@ var MaterialQuizGroup = function MaterialQuizGroup() {
350
350
  handleAnswerReset: handleAnswerReset
351
351
  },
352
352
  children: jsxs(QuestionBox, {
353
+ titlePrefix: "Q.",
353
354
  title: materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.questionTitle,
354
355
  onNext: onNext,
355
356
  isNextActive: isNextActive,
@@ -4,6 +4,7 @@ import { base } from '@elice/design-tokens';
4
4
  import { eilMathsignMultiplyBasic } from '@elice/icons';
5
5
  import { MarkdownSSR } from '@elice/markdown';
6
6
  import styled from 'styled-components';
7
+ import { addAltTextToImage } from '../../../helpers/index.js';
7
8
  import EbDraggable from '../../eb-sortable/EbDraggable.js';
8
9
  import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
9
10
 
@@ -76,7 +77,7 @@ var MaterialQuizGroupOptionItem = function MaterialQuizGroupOptionItem(_ref7) {
76
77
  children: [isOptionContent ? jsx(StyledOptionContent, {
77
78
  vertical: vertical,
78
79
  children: jsx(MarkdownSSR, {
79
- children: (_a = option.options.content) !== null && _a !== void 0 ? _a : '',
80
+ children: (_a = addAltTextToImage(option.options)) !== null && _a !== void 0 ? _a : '',
80
81
  paddingx: 0,
81
82
  paddingy: 0,
82
83
  dark: true
@@ -3,6 +3,6 @@ import styled from 'styled-components';
3
3
 
4
4
  var StyledMarkdown = styled(Markdown).withConfig({
5
5
  componentId: "sc-l6r531-0"
6
- })(["p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
6
+ })(["& > .elicemd{overflow:hidden;}p{margin:0 !important;}code{white-space:pre-wrap;word-break:break-all;}"]);
7
7
 
8
8
  export { StyledMarkdown as default };
@@ -82,10 +82,10 @@ var QuestionRadioOption = React.memo(function (_ref6) {
82
82
  onSelect(value);
83
83
  },
84
84
  status: status,
85
+ "aria-checked": selectedValue === value,
85
86
  children: [jsx(StyledQuestionRadioInput, {
86
87
  id: value,
87
88
  type: "radio",
88
- readOnly: true,
89
89
  checked: selectedValue === value,
90
90
  status: status
91
91
  }), jsx(StyledLabel, {
@@ -1,5 +1,6 @@
1
1
  import type { GetOrgLectureGetResponses, GetOrgMaterialQuizResponseGetResponses } from '@elice/types';
2
2
  import type { QuizOptionType } from '@elice/types/es/enums';
3
+ import type { QuizGroupOption } from "../components/material-quiz/material-quiz-group/context/context";
3
4
  interface OptionInfo {
4
5
  content: string;
5
6
  optionType: QuizOptionType;
@@ -46,4 +47,5 @@ export declare function shouldResetOptions({ materialQuizResponse, }: {
46
47
  materialQuizResponse?: GetOrgMaterialQuizResponseGetResponses['quizResponse'];
47
48
  }): boolean;
48
49
  export declare function getQuizResult(materialQuizResponse: GetOrgMaterialQuizResponseGetResponses['quizResponse']): boolean | undefined;
50
+ export declare const addAltTextToImage: ({ content, title, }: QuizGroupOption['options']) => string | undefined;
49
51
  export {};
@@ -60,5 +60,14 @@ function getQuizResult(materialQuizResponse) {
60
60
  return;
61
61
  }
62
62
  }
63
+ var addAltTextToImage = function addAltTextToImage(_ref3) {
64
+ var content = _ref3.content,
65
+ title = _ref3.title;
66
+ if (!title) return content;
67
+ // Match the pattern ![](<url>)
68
+ var regex = /!\[]\((.*?)\)/;
69
+ // Replace with the alt text inside the []
70
+ return content === null || content === void 0 ? void 0 : content.replace(regex, "![".concat(title, "]($1)"));
71
+ };
63
72
 
64
- export { QuizResultStatus, checkUserLectureTestEnded, getOptionStatus, getQuizResult, getQuizResultStatus, shouldResetOptions };
73
+ export { QuizResultStatus, addAltTextToImage, checkUserLectureTestEnded, getOptionStatus, getQuizResult, getQuizResultStatus, shouldResetOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-quiz",
3
- "version": "1.240806.0-pdf.0",
3
+ "version": "1.240808.0",
4
4
  "description": "User view and editing components of Elice material quiz",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -60,14 +60,14 @@
60
60
  "devDependencies": {
61
61
  "@dnd-kit/core": "^6.1.0",
62
62
  "@elice/api-client": "^1.240619.0",
63
- "@elice/blocks": "^1.240529.0",
63
+ "@elice/blocks": "1.240802.1",
64
64
  "@elice/design-tokens": "^1.220803.0",
65
65
  "@elice/icons": "^1.230814.0",
66
66
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
67
67
  "@elice/intl": "0.240425.0-rc.2",
68
68
  "@elice/markdown": "^1.240124.0",
69
- "@elice/material-shared-types": "1.240722.0",
70
- "@elice/material-shared-utils": "1.240722.0",
69
+ "@elice/material-shared-types": "1.240808.0",
70
+ "@elice/material-shared-utils": "1.240808.0",
71
71
  "@elice/mui-system": "^5.240108.1",
72
72
  "@elice/types": "1.240709.0",
73
73
  "@elice/wysiwyg": "1.240716.1",