eat-js-sdk 2.0.45 → 2.0.46
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/dist/interaction-builder.mjs +312 -172
- package/package.json +1 -1
|
@@ -5121,7 +5121,11 @@ const DROPDOWN_POSITION = {
|
|
|
5121
5121
|
};
|
|
5122
5122
|
const DROPDOWN_INTERACTION = {
|
|
5123
5123
|
KEY_PRESS_TIMEOUT: 1e3,
|
|
5124
|
-
PAGE_NAVIGATION_STEP: 10
|
|
5124
|
+
PAGE_NAVIGATION_STEP: 10,
|
|
5125
|
+
PLACEHOLDER: "Select Answer",
|
|
5126
|
+
SAVE_DEBOUNCE_DELAY: 500,
|
|
5127
|
+
RESIZE_DEBOUNCE_DELAY: 150,
|
|
5128
|
+
EMPTY_CHOICE: ""
|
|
5125
5129
|
};
|
|
5126
5130
|
const INTERACTION_TYPE_MAP = {
|
|
5127
5131
|
[INTERACTION_TYPES.MCQ]: "mcq",
|
|
@@ -5776,7 +5780,7 @@ function ResultIcon($$anchor, $$props) {
|
|
|
5776
5780
|
return pop($$exports);
|
|
5777
5781
|
}
|
|
5778
5782
|
create_custom_element(ResultIcon, { isCorrect: {}, iconType: {}, parentProps: {} }, [], [], true);
|
|
5779
|
-
var root_3$
|
|
5783
|
+
var root_3$b = /* @__PURE__ */ from_html(`<span class="sr-only">Alert. </span>`);
|
|
5780
5784
|
var root_1$n = /* @__PURE__ */ from_html(`<div><!> <div><!> <span><!></span></div></div>`);
|
|
5781
5785
|
function FeedbackAlert($$anchor, $$props) {
|
|
5782
5786
|
push($$props, true);
|
|
@@ -5869,7 +5873,7 @@ function FeedbackAlert($$anchor, $$props) {
|
|
|
5869
5873
|
var node_2 = child(div_1);
|
|
5870
5874
|
{
|
|
5871
5875
|
var consequent_1 = ($$anchor3) => {
|
|
5872
|
-
var span = root_3$
|
|
5876
|
+
var span = root_3$b();
|
|
5873
5877
|
append($$anchor3, span);
|
|
5874
5878
|
};
|
|
5875
5879
|
if_block(node_2, ($$render) => {
|
|
@@ -6881,9 +6885,9 @@ function useImageModalSize() {
|
|
|
6881
6885
|
calculateStimulusImageLayout
|
|
6882
6886
|
};
|
|
6883
6887
|
}
|
|
6884
|
-
var root_3$
|
|
6888
|
+
var root_3$a = /* @__PURE__ */ from_html(`<span class="w-6 h-6 flex items-center justify-center"><!></span>`);
|
|
6885
6889
|
var root_4$6 = /* @__PURE__ */ from_html(`<span class="w-6 h-6 flex items-center justify-center"><!></span>`);
|
|
6886
|
-
var root_5$
|
|
6890
|
+
var root_5$6 = /* @__PURE__ */ from_html(`<div><span aria-hidden="true"><!></span></div>`);
|
|
6887
6891
|
var root_8$4 = /* @__PURE__ */ from_html(`<span class="w-4 h-4 flex items-center justify-center"><!></span>`);
|
|
6888
6892
|
var root_9$2 = /* @__PURE__ */ from_html(`<span class="w-4 h-4 flex items-center justify-center"><!></span>`);
|
|
6889
6893
|
var root_2$e = /* @__PURE__ */ from_html(`<div class="absolute inset-0 m-0"><div class="w-full h-full px-0 md:px-[82px] lg:px-[128px] pt-14 pb-[72px] relative lg:py-24 flex flex-col items-center justify-center"><div aria-live="polite" aria-atomic="true" class="sr-only"> </div> <div class="w-full h-full flex flex-col md:flex-row md:justify-center items-center justify-between"><div class="md:hidden"></div> <!> <!> <div><div class="flex-shrink-0 flex items-center justify-between py-1 px-2 md:px-4 border-border-minimal border rounded-t-md lg:rounded-t-lg md:gap-4 h-8.5 md:h-fit"><!> <!> <!></div> <div class="rounded-b-md"><img class="mx-auto block rounded-b-md lg:rounded-b-lg object-contain max-w-full max-h-[calc(100vh-168px-34px)] md:max-h-[calc(100vh-128px-54px)] lg:max-h-[calc(100vh-192px-54px)] pointer-events-none"/></div></div> <div class="md:hidden flex justify-center items-center gap-1 flex-shrink-0 h-6 mt-4"><!> <!></div></div></div></div>`);
|
|
@@ -7109,7 +7113,7 @@ function MCQImageModal($$anchor, $$props) {
|
|
|
7109
7113
|
},
|
|
7110
7114
|
onclick: navigatePrevious,
|
|
7111
7115
|
children: ($$anchor4, $$slotProps2) => {
|
|
7112
|
-
var span = root_3$
|
|
7116
|
+
var span = root_3$a();
|
|
7113
7117
|
var node_2 = child(span);
|
|
7114
7118
|
SvgLoader(node_2, {
|
|
7115
7119
|
svgName: "smallChevronLeft",
|
|
@@ -7164,7 +7168,7 @@ function MCQImageModal($$anchor, $$props) {
|
|
|
7164
7168
|
return get$1(fullAnswerText);
|
|
7165
7169
|
},
|
|
7166
7170
|
children: ($$anchor4, $$slotProps2) => {
|
|
7167
|
-
var div_6 = root_5$
|
|
7171
|
+
var div_6 = root_5$6();
|
|
7168
7172
|
var span_2 = child(div_6);
|
|
7169
7173
|
var node_6 = child(span_2);
|
|
7170
7174
|
{
|
|
@@ -7467,7 +7471,7 @@ function InteractionSection($$anchor, $$props) {
|
|
|
7467
7471
|
return pop($$exports);
|
|
7468
7472
|
}
|
|
7469
7473
|
create_custom_element(InteractionSection, { children: {} }, [], [], true);
|
|
7470
|
-
var root_5$
|
|
7474
|
+
var root_5$5 = /* @__PURE__ */ from_html(`<div></div>`);
|
|
7471
7475
|
var root_4$5 = /* @__PURE__ */ from_html(`<div class="px-4 w-full max-w-[1008px] mx-auto flex-shrink-0 text-center font-semibold text-sm md:text-lg leading-[150%] text-white" aria-hidden="true"> </div> <!>`, 1);
|
|
7472
7476
|
var root_7$4 = /* @__PURE__ */ from_html(`<div></div>`);
|
|
7473
7477
|
var root_2$d = /* @__PURE__ */ from_html(`<div class="absolute inset-0"><div class="w-full h-full flex items-center justify-center pt-14 pb-[72px] lg:py-24"><div aria-live="polite" aria-atomic="true" class="sr-only"> </div> <div class="flex flex-col items-center overflow-y-auto w-full px-0 md:px-6 lg:px-16"><div class="relative bg-white rounded-md md:rounded-lg shadow-sm overflow-hidden flex-shrink-0"><img class="block object-contain w-full h-auto max-w-full mx-auto"/> <!></div> <!></div></div></div>`);
|
|
@@ -7639,7 +7643,7 @@ function PromptStimulusImageModal($$anchor, $$props) {
|
|
|
7639
7643
|
var node_3 = sibling(div_5, 2);
|
|
7640
7644
|
{
|
|
7641
7645
|
var consequent = ($$anchor5) => {
|
|
7642
|
-
var div_6 = root_5$
|
|
7646
|
+
var div_6 = root_5$5();
|
|
7643
7647
|
template_effect(() => set_style(div_6, `height:${get$1(bottomSpacerHeight) ?? ""}px`));
|
|
7644
7648
|
append($$anchor5, div_6);
|
|
7645
7649
|
};
|
|
@@ -8081,7 +8085,7 @@ const shouldRenderSection = (section) => section.condition !== false;
|
|
|
8081
8085
|
const getClassString = (classes = []) => classes.join(" ");
|
|
8082
8086
|
const getStyleString = (styles = {}) => Object.entries(styles).map(([k, v]) => `${k}:${v}`).join(";");
|
|
8083
8087
|
var root_4$4 = /* @__PURE__ */ from_html(`<p class="text-lg leading-[22px] text-blue-1000 font-semibold mt-4"> </p>`);
|
|
8084
|
-
var root_5$
|
|
8088
|
+
var root_5$4 = /* @__PURE__ */ from_html(`<div class="mt-6 w-full"><button class="flex items-center font-semibold leading-[1.5] outline-none group w-fit h-11 text-charcoal" aria-controls="long-description-content" aria-labelledby="image-description-label" type="button"><div class="w-6 h-6 flex items-center justify-center mr-2"><!></div> <div id="image-description-label" class="image-description-accordion group-[.active]:border-b-2">Image Description</div></button> <div id="long-description-content"><!></div></div>`);
|
|
8085
8089
|
var root_2$c = /* @__PURE__ */ from_html(`<div class="flex flex-col justify-center items-center text-center"><div class="flex flex-col items-center"><div class="relative inline-block"><img loading="lazy"/> <!></div> <!></div></div> <!>`, 1);
|
|
8086
8090
|
var root_1$j = /* @__PURE__ */ from_html(`<div class="w-full"><!></div>`);
|
|
8087
8091
|
function CommonMedia($$anchor, $$props) {
|
|
@@ -8213,7 +8217,7 @@ function CommonMedia($$anchor, $$props) {
|
|
|
8213
8217
|
var node_4 = sibling(div_1, 2);
|
|
8214
8218
|
{
|
|
8215
8219
|
var consequent_1 = ($$anchor4) => {
|
|
8216
|
-
var div_4 = root_5$
|
|
8220
|
+
var div_4 = root_5$4();
|
|
8217
8221
|
var button = child(div_4);
|
|
8218
8222
|
button.__click = toggleLongDescription;
|
|
8219
8223
|
button.__keydown = handleKeyDown;
|
|
@@ -8297,12 +8301,12 @@ create_custom_element(
|
|
|
8297
8301
|
[],
|
|
8298
8302
|
true
|
|
8299
8303
|
);
|
|
8300
|
-
var root_3$
|
|
8304
|
+
var root_3$9 = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8301
8305
|
var root_4$3 = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8302
8306
|
var root_2$b = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
8303
8307
|
var root_6$2 = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8304
8308
|
var root_7$3 = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8305
|
-
var root_5$
|
|
8309
|
+
var root_5$3 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
8306
8310
|
var root_1$i = /* @__PURE__ */ from_html(`<div class="stimulus-section flex flex-col w-full"><!></div>`);
|
|
8307
8311
|
function StimulusSection($$anchor, $$props) {
|
|
8308
8312
|
push($$props, true);
|
|
@@ -8373,7 +8377,7 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8373
8377
|
var node_2 = first_child(fragment_1);
|
|
8374
8378
|
{
|
|
8375
8379
|
var consequent = ($$anchor4) => {
|
|
8376
|
-
var div_1 = root_3$
|
|
8380
|
+
var div_1 = root_3$9();
|
|
8377
8381
|
var node_3 = child(div_1);
|
|
8378
8382
|
CommonStringToHtml(node_3, {
|
|
8379
8383
|
get htmlString() {
|
|
@@ -8427,7 +8431,7 @@ function StimulusSection($$anchor, $$props) {
|
|
|
8427
8431
|
append($$anchor3, fragment_1);
|
|
8428
8432
|
};
|
|
8429
8433
|
var alternate = ($$anchor3) => {
|
|
8430
|
-
var fragment_2 = root_5$
|
|
8434
|
+
var fragment_2 = root_5$3();
|
|
8431
8435
|
var node_6 = first_child(fragment_2);
|
|
8432
8436
|
{
|
|
8433
8437
|
var consequent_3 = ($$anchor4) => {
|
|
@@ -8512,10 +8516,10 @@ create_custom_element(
|
|
|
8512
8516
|
true
|
|
8513
8517
|
);
|
|
8514
8518
|
var root_8$3 = /* @__PURE__ */ from_html(`<div class="divider my-6"></div>`);
|
|
8515
|
-
var root_13
|
|
8516
|
-
var root_15
|
|
8519
|
+
var root_13 = /* @__PURE__ */ from_html(`<div class="divider my-6"></div>`);
|
|
8520
|
+
var root_15 = /* @__PURE__ */ from_html(`<div aria-live="polite"><!></div>`);
|
|
8517
8521
|
var root_1$h = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8518
|
-
var root_16 = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8522
|
+
var root_16$1 = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
8519
8523
|
var root$e = /* @__PURE__ */ from_html(`<div class="prompt-container"><div><div></div> <!></div></div> <!>`, 1);
|
|
8520
8524
|
function PromptContainer($$anchor, $$props) {
|
|
8521
8525
|
push($$props, true);
|
|
@@ -8706,7 +8710,7 @@ function PromptContainer($$anchor, $$props) {
|
|
|
8706
8710
|
var node_6 = first_child(fragment_10);
|
|
8707
8711
|
{
|
|
8708
8712
|
var consequent_5 = ($$anchor8) => {
|
|
8709
|
-
var div_5 = root_13
|
|
8713
|
+
var div_5 = root_13();
|
|
8710
8714
|
append($$anchor8, div_5);
|
|
8711
8715
|
};
|
|
8712
8716
|
var alternate = ($$anchor8) => {
|
|
@@ -8714,7 +8718,7 @@ function PromptContainer($$anchor, $$props) {
|
|
|
8714
8718
|
var node_7 = first_child(fragment_11);
|
|
8715
8719
|
{
|
|
8716
8720
|
var consequent_6 = ($$anchor9) => {
|
|
8717
|
-
var div_6 = root_15
|
|
8721
|
+
var div_6 = root_15();
|
|
8718
8722
|
var node_8 = child(div_6);
|
|
8719
8723
|
snippet(node_8, () => feedback() ?? noop);
|
|
8720
8724
|
reset(div_6);
|
|
@@ -8807,7 +8811,7 @@ function PromptContainer($$anchor, $$props) {
|
|
|
8807
8811
|
var node_9 = sibling(div_2, 2);
|
|
8808
8812
|
{
|
|
8809
8813
|
var consequent_7 = ($$anchor2) => {
|
|
8810
|
-
var div_7 = root_16();
|
|
8814
|
+
var div_7 = root_16$1();
|
|
8811
8815
|
var node_10 = child(div_7);
|
|
8812
8816
|
StimulusSection(node_10, {
|
|
8813
8817
|
get stimulusData() {
|
|
@@ -8894,9 +8898,9 @@ create_custom_element(
|
|
|
8894
8898
|
);
|
|
8895
8899
|
var root_1$g = /* @__PURE__ */ from_html(`<p class="text-charcoal text-sm leading-[19.2px] mb-2"> </p>`);
|
|
8896
8900
|
var root_2$a = /* @__PURE__ */ from_html(`<span class="text-gray-860 text-sm mb-0.5"> </span>`);
|
|
8897
|
-
var root_3$
|
|
8901
|
+
var root_3$8 = /* @__PURE__ */ from_html(`<span class="text-gray-860 text-sm mb-0.5">Missing answer:</span>`);
|
|
8898
8902
|
var root_4$2 = /* @__PURE__ */ from_html(`<span aria-hidden="true" class="text-green-900 mr-1"><!></span>`);
|
|
8899
|
-
var root_5$
|
|
8903
|
+
var root_5$2 = /* @__PURE__ */ from_html(`<span aria-hidden="true"><!></span>`);
|
|
8900
8904
|
var root_9$1 = /* @__PURE__ */ from_html(`<span class="w-3 h-2 flex items-center justify-center"><!></span>`);
|
|
8901
8905
|
var root_8$2 = /* @__PURE__ */ from_html(`<span><!></span>`);
|
|
8902
8906
|
var root_10$1 = /* @__PURE__ */ from_html(`<div class="w-full overflow-hidden bg-white rounded-b-lg flex items-center justify-center relative"><img class="min-h-[154px] max-h-[184px] w-auto max-w-full object-contain pointer-events-none" loading="lazy"/></div>`);
|
|
@@ -9028,7 +9032,7 @@ function MCQOption($$anchor, $$props) {
|
|
|
9028
9032
|
var node_2 = sibling(node_1, 2);
|
|
9029
9033
|
{
|
|
9030
9034
|
var consequent_2 = ($$anchor2) => {
|
|
9031
|
-
var span_6 = root_3$
|
|
9035
|
+
var span_6 = root_3$8();
|
|
9032
9036
|
append($$anchor2, span_6);
|
|
9033
9037
|
};
|
|
9034
9038
|
if_block(node_2, ($$render) => {
|
|
@@ -9061,7 +9065,7 @@ function MCQOption($$anchor, $$props) {
|
|
|
9061
9065
|
var node_6 = sibling(node_4, 2);
|
|
9062
9066
|
{
|
|
9063
9067
|
var consequent_5 = ($$anchor2) => {
|
|
9064
|
-
var span_9 = root_5$
|
|
9068
|
+
var span_9 = root_5$2();
|
|
9065
9069
|
var node_7 = child(span_9);
|
|
9066
9070
|
{
|
|
9067
9071
|
var consequent_4 = ($$anchor3) => {
|
|
@@ -9308,7 +9312,7 @@ create_custom_element(
|
|
|
9308
9312
|
[],
|
|
9309
9313
|
true
|
|
9310
9314
|
);
|
|
9311
|
-
var root_3$
|
|
9315
|
+
var root_3$7 = /* @__PURE__ */ from_html(`<div aria-live="polite" class="mb-6"><!></div>`);
|
|
9312
9316
|
var root$c = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
9313
9317
|
function MCQComponent($$anchor, $$props) {
|
|
9314
9318
|
push($$props, true);
|
|
@@ -9446,7 +9450,7 @@ function MCQComponent($$anchor, $$props) {
|
|
|
9446
9450
|
var node_1 = first_child(fragment_2);
|
|
9447
9451
|
{
|
|
9448
9452
|
var consequent = ($$anchor3) => {
|
|
9449
|
-
var div = root_3$
|
|
9453
|
+
var div = root_3$7();
|
|
9450
9454
|
var node_2 = child(div);
|
|
9451
9455
|
MCQFeedback(node_2, {
|
|
9452
9456
|
get feedbackState() {
|
|
@@ -10297,7 +10301,7 @@ action.update = n.update;
|
|
|
10297
10301
|
action.destroy = n.destroy;
|
|
10298
10302
|
var root_1$c = /* @__PURE__ */ from_html(`<label aria-hidden="true"><span></span> <span> </span></label>`);
|
|
10299
10303
|
var root_2$6 = /* @__PURE__ */ from_html(`<div role="textbox" aria-readonly="true"><!></div>`);
|
|
10300
|
-
var root_3$
|
|
10304
|
+
var root_3$6 = /* @__PURE__ */ from_html(`<textarea rows="1" readonly=""></textarea>`);
|
|
10301
10305
|
var root_4 = /* @__PURE__ */ from_html(`<span class="w-6 h-6 absolute right-4 top-[calc(50%+0.375rem)] -translate-y-1/2 flex items-center justify-center"><!></span>`);
|
|
10302
10306
|
var root$9 = /* @__PURE__ */ from_html(`<div><!> <!> <!></div>`);
|
|
10303
10307
|
function AnswerDisplay($$anchor, $$props) {
|
|
@@ -10478,7 +10482,7 @@ function AnswerDisplay($$anchor, $$props) {
|
|
|
10478
10482
|
append($$anchor2, div_1);
|
|
10479
10483
|
};
|
|
10480
10484
|
var alternate = ($$anchor2) => {
|
|
10481
|
-
var textarea = root_3$
|
|
10485
|
+
var textarea = root_3$6();
|
|
10482
10486
|
remove_textarea_child(textarea);
|
|
10483
10487
|
action$1(textarea, ($$node) => action?.($$node));
|
|
10484
10488
|
template_effect(() => {
|
|
@@ -10971,7 +10975,7 @@ create_custom_element(
|
|
|
10971
10975
|
[],
|
|
10972
10976
|
true
|
|
10973
10977
|
);
|
|
10974
|
-
var root_3$
|
|
10978
|
+
var root_3$5 = /* @__PURE__ */ from_html(`<p></p>`);
|
|
10975
10979
|
var root_8$1 = /* @__PURE__ */ from_html(`<div class="absolute inset-0 bg-transparent z-50"></div>`);
|
|
10976
10980
|
var root_2$4 = /* @__PURE__ */ from_html(`<div class="inline-typein-container mt-6 relative"><!> <div class="divider my-6"></div> <!></div>`);
|
|
10977
10981
|
function TypeInComponent($$anchor, $$props) {
|
|
@@ -11175,7 +11179,7 @@ function TypeInComponent($$anchor, $$props) {
|
|
|
11175
11179
|
var div = root_2$4();
|
|
11176
11180
|
var node_1 = child(div);
|
|
11177
11181
|
each(node_1, 17, () => segments, index, ($$anchor4, segment) => {
|
|
11178
|
-
var p = root_3$
|
|
11182
|
+
var p = root_3$5();
|
|
11179
11183
|
each(p, 21, () => get$1(segment).parts, index, ($$anchor5, part, partIndex) => {
|
|
11180
11184
|
var fragment_2 = comment();
|
|
11181
11185
|
var node_2 = first_child(fragment_2);
|
|
@@ -13842,8 +13846,8 @@ function isInt(value) {
|
|
|
13842
13846
|
})(parseFloat(value));
|
|
13843
13847
|
}
|
|
13844
13848
|
var root_1$9 = /* @__PURE__ */ from_html(`<span class="text-green-800 preview-icon"><!></span>`);
|
|
13845
|
-
var root_3$
|
|
13846
|
-
var root_5$
|
|
13849
|
+
var root_3$4 = /* @__PURE__ */ from_html(`<span class="text-red-800 preview-icon"><!></span>`);
|
|
13850
|
+
var root_5$1 = /* @__PURE__ */ from_html(`<span class="text-green-800"><!></span>`);
|
|
13847
13851
|
var root_7$2 = /* @__PURE__ */ from_html(`<span class="preview-vertical hidden"><!></span>`);
|
|
13848
13852
|
var root$6 = /* @__PURE__ */ from_html(`<button data-item-button=""><span><!></span> <div><span></span> <span class="absolute"><!> <!></span></div></button>`);
|
|
13849
13853
|
function CategoriseItem($$anchor, $$props) {
|
|
@@ -14136,7 +14140,7 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
14136
14140
|
var node_3 = first_child(fragment);
|
|
14137
14141
|
{
|
|
14138
14142
|
var consequent_1 = ($$anchor3) => {
|
|
14139
|
-
var span_4 = root_3$
|
|
14143
|
+
var span_4 = root_3$4();
|
|
14140
14144
|
var node_4 = child(span_4);
|
|
14141
14145
|
SvgLoader(node_4, { svgName: "errorSolid", className: "incorrect-icon" });
|
|
14142
14146
|
reset(span_4);
|
|
@@ -14147,7 +14151,7 @@ function CategoriseItem($$anchor, $$props) {
|
|
|
14147
14151
|
var node_5 = first_child(fragment_1);
|
|
14148
14152
|
{
|
|
14149
14153
|
var consequent_2 = ($$anchor4) => {
|
|
14150
|
-
var span_5 = root_5$
|
|
14154
|
+
var span_5 = root_5$1();
|
|
14151
14155
|
var node_6 = child(span_5);
|
|
14152
14156
|
SvgLoader(node_6, { svgName: "success", className: "missing-correct-icon" });
|
|
14153
14157
|
reset(span_5);
|
|
@@ -14653,7 +14657,7 @@ create_custom_element(
|
|
|
14653
14657
|
true
|
|
14654
14658
|
);
|
|
14655
14659
|
var root_2$3 = /* @__PURE__ */ from_svg(`<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>`);
|
|
14656
|
-
var root_3$
|
|
14660
|
+
var root_3$3 = /* @__PURE__ */ from_svg(`<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path></svg>`);
|
|
14657
14661
|
var root_1$7 = /* @__PURE__ */ from_html(`<button type="button" class="focus-ring flex items-center rounded-[32px] p-1.5 text-charcoal text-sm border border-gray-800 bg-gray-50 min-w-[85px] ml-3 whitespace-nowrap active:raw-focus-ring active:bg-black-55"><span class="mx-0.5"> </span> <span class="w-4 h-4 text-inherit flex items-center justify-center"><!></span></button>`);
|
|
14658
14662
|
var root$4 = /* @__PURE__ */ from_html(`<div role="group"><div><!> <!></div> <!></div>`);
|
|
14659
14663
|
function CategoriseCategory($$anchor, $$props) {
|
|
@@ -14920,7 +14924,7 @@ function CategoriseCategory($$anchor, $$props) {
|
|
|
14920
14924
|
append($$anchor3, svg);
|
|
14921
14925
|
};
|
|
14922
14926
|
var alternate = ($$anchor3) => {
|
|
14923
|
-
var svg_1 = root_3$
|
|
14927
|
+
var svg_1 = root_3$3();
|
|
14924
14928
|
append($$anchor3, svg_1);
|
|
14925
14929
|
};
|
|
14926
14930
|
if_block(node_2, ($$render) => {
|
|
@@ -15056,7 +15060,7 @@ create_custom_element(
|
|
|
15056
15060
|
var root_1$6 = /* @__PURE__ */ from_html(`<div role="group" tabindex="-1" class="text-base leading-4 text-gray-800 p-5 border border-gray-400 rounded-lg border-dashed
|
|
15057
15061
|
absolute top-12 right-4 left-4 bottom-4 flex items-center justify-center !bg-white md:top-20">Word Bin is empty</div>`);
|
|
15058
15062
|
var root_2$2 = /* @__PURE__ */ from_html(`<button type="button" class="focus-ring p-2 text-blue-1000 rounded-md w-11 h-11 mt-9 td:hover:bg-black-50 active:bg-black-60 disabled:text-gray-40 disabled:hover:bg-white md:hidden" aria-label="Left"><span class="w-6 h-6 text-inherit flex items-center justify-center"><!></span></button>`);
|
|
15059
|
-
var root_3$
|
|
15063
|
+
var root_3$2 = /* @__PURE__ */ from_html(`<button type="button" class="focus-ring p-2 text-blue-1000 rounded-md w-11 h-11 mt-9 td:hover:bg-black-50 active:bg-black-60 disabled:text-gray-40 disabled:hover:bg-white md:hidden" aria-label="Right"><span class="w-6 h-6 text-inherit flex items-center justify-center ml-[3px]"><!></span></button>`);
|
|
15060
15064
|
var root$3 = /* @__PURE__ */ from_html(`<div role="group"><div><span class="text-base leading-5 !text-gray-900 font-semibold md:mb-2 md:item-heading">Word Bin </span> <span class="text-base leading-5 !text-gray-900 md:item-heading"> </span></div> <div class="flex items-center justify-between px-4 min-h-[133px] md:min-h-0 md:block md:px-0 md:justify-normal"><!> <!> <!> <!></div></div>`);
|
|
15061
15065
|
function CategoriseWordBin($$anchor, $$props) {
|
|
15062
15066
|
push($$props, true);
|
|
@@ -15369,7 +15373,7 @@ function CategoriseWordBin($$anchor, $$props) {
|
|
|
15369
15373
|
var node_4 = sibling(node_3, 2);
|
|
15370
15374
|
{
|
|
15371
15375
|
var consequent_2 = ($$anchor2) => {
|
|
15372
|
-
var button_1 = root_3$
|
|
15376
|
+
var button_1 = root_3$2();
|
|
15373
15377
|
button_1.__click = () => handleNavigate("right");
|
|
15374
15378
|
button_1.__keydown = (e2) => {
|
|
15375
15379
|
if (e2.key === "Enter" || e2.key === " ") {
|
|
@@ -16953,83 +16957,144 @@ function createDropdownState(initialValue) {
|
|
|
16953
16957
|
searchString: ""
|
|
16954
16958
|
};
|
|
16955
16959
|
}
|
|
16956
|
-
const
|
|
16957
|
-
return
|
|
16960
|
+
const hasRenderedIds = (ids) => {
|
|
16961
|
+
return !!ids && ids.length > 0;
|
|
16962
|
+
};
|
|
16963
|
+
const createSelectionMap = (selections) => {
|
|
16964
|
+
return new Map(selections.map((s) => [s.id, s]));
|
|
16965
|
+
};
|
|
16966
|
+
const isAllAnswered$1 = (selections, renderedIds) => {
|
|
16967
|
+
if (hasRenderedIds(renderedIds)) {
|
|
16968
|
+
const selectionMap = createSelectionMap(selections);
|
|
16969
|
+
return renderedIds.every((id) => {
|
|
16970
|
+
const selection = selectionMap.get(id);
|
|
16971
|
+
return selection && selection.choice !== DROPDOWN_INTERACTION.EMPTY_CHOICE && selection.choice !== DROPDOWN_INTERACTION.PLACEHOLDER;
|
|
16972
|
+
});
|
|
16973
|
+
}
|
|
16974
|
+
return selections.every(
|
|
16975
|
+
(item) => item.choice !== DROPDOWN_INTERACTION.EMPTY_CHOICE && item.choice !== DROPDOWN_INTERACTION.PLACEHOLDER
|
|
16976
|
+
);
|
|
16958
16977
|
};
|
|
16959
|
-
const isAllSkipped = (selections) => {
|
|
16960
|
-
|
|
16978
|
+
const isAllSkipped = (selections, renderedIds) => {
|
|
16979
|
+
if (hasRenderedIds(renderedIds)) {
|
|
16980
|
+
const selectionMap = createSelectionMap(selections);
|
|
16981
|
+
return renderedIds.every((id) => {
|
|
16982
|
+
const selection = selectionMap.get(id);
|
|
16983
|
+
return !selection || selection.choice === DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
16984
|
+
});
|
|
16985
|
+
}
|
|
16986
|
+
return selections.every((item) => item.choice === DROPDOWN_INTERACTION.EMPTY_CHOICE);
|
|
16961
16987
|
};
|
|
16962
|
-
const calculateAnswerResults = (config, selections) => {
|
|
16988
|
+
const calculateAnswerResults = (config, selections, renderedIds) => {
|
|
16989
|
+
const selectionMap = createSelectionMap(selections);
|
|
16990
|
+
if (hasRenderedIds(renderedIds)) {
|
|
16991
|
+
return renderedIds.map((id) => {
|
|
16992
|
+
const selection = selectionMap.get(id);
|
|
16993
|
+
if (!selection) return false;
|
|
16994
|
+
const correctAnswers = config.correctAnswer[id] || [];
|
|
16995
|
+
if (correctAnswers.length === 0) return false;
|
|
16996
|
+
return correctAnswers.includes(selection.choice);
|
|
16997
|
+
});
|
|
16998
|
+
}
|
|
16963
16999
|
return selections.map((item) => {
|
|
16964
17000
|
const correctAnswers = config.correctAnswer[item.id] || [];
|
|
16965
17001
|
if (correctAnswers.length === 0) return false;
|
|
16966
17002
|
return correctAnswers.includes(item.choice);
|
|
16967
17003
|
});
|
|
16968
17004
|
};
|
|
16969
|
-
const getCorrectAnswersForDisplay = (config, selections, answerResults) => {
|
|
17005
|
+
const getCorrectAnswersForDisplay = (config, selections, answerResults, renderedIds) => {
|
|
17006
|
+
const selectionMap = createSelectionMap(selections);
|
|
17007
|
+
if (hasRenderedIds(renderedIds)) {
|
|
17008
|
+
return renderedIds.map((id, index2) => {
|
|
17009
|
+
const selection = selectionMap.get(id);
|
|
17010
|
+
const correctAnswersList = config.correctAnswer[id] || [];
|
|
17011
|
+
const firstCorrectAnswer = correctAnswersList[0] || DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
17012
|
+
const isDropdownCorrect = answerResults[index2];
|
|
17013
|
+
if (correctAnswersList.length === 0) return DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
17014
|
+
return isDropdownCorrect && selection ? selection.choice : firstCorrectAnswer;
|
|
17015
|
+
});
|
|
17016
|
+
}
|
|
16970
17017
|
return selections.map((item, index2) => {
|
|
16971
17018
|
const correctAnswersList = config.correctAnswer[item.id] || [];
|
|
16972
|
-
const firstCorrectAnswer = correctAnswersList[0] ||
|
|
16973
|
-
const
|
|
16974
|
-
if (correctAnswersList.length === 0) return
|
|
16975
|
-
return
|
|
17019
|
+
const firstCorrectAnswer = correctAnswersList[0] || DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
17020
|
+
const isDropdownCorrect = answerResults[index2];
|
|
17021
|
+
if (correctAnswersList.length === 0) return DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
17022
|
+
return isDropdownCorrect ? item.choice : firstCorrectAnswer;
|
|
16976
17023
|
});
|
|
16977
17024
|
};
|
|
16978
|
-
const getSessionAnswersForDisplay = (selections) => {
|
|
17025
|
+
const getSessionAnswersForDisplay = (selections, renderedIds) => {
|
|
17026
|
+
const selectionMap = createSelectionMap(selections);
|
|
17027
|
+
if (hasRenderedIds(renderedIds)) {
|
|
17028
|
+
return renderedIds.map((id) => {
|
|
17029
|
+
const selection = selectionMap.get(id);
|
|
17030
|
+
const answer = selection?.choice || DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
17031
|
+
return answer === DROPDOWN_INTERACTION.PLACEHOLDER || answer === DROPDOWN_INTERACTION.EMPTY_CHOICE ? DROPDOWN_INTERACTION.EMPTY_CHOICE : answer;
|
|
17032
|
+
});
|
|
17033
|
+
}
|
|
16979
17034
|
return selections.map((item) => {
|
|
16980
|
-
const answer = item.choice ||
|
|
16981
|
-
return answer ===
|
|
17035
|
+
const answer = item.choice || DROPDOWN_INTERACTION.EMPTY_CHOICE;
|
|
17036
|
+
return answer === DROPDOWN_INTERACTION.PLACEHOLDER || answer === DROPDOWN_INTERACTION.EMPTY_CHOICE ? DROPDOWN_INTERACTION.EMPTY_CHOICE : answer;
|
|
16982
17037
|
});
|
|
16983
17038
|
};
|
|
16984
|
-
function calculateDropdownFeedback(state2, config, validateFn) {
|
|
17039
|
+
function calculateDropdownFeedback(state2, config, validateFn, renderedDropdownIds) {
|
|
16985
17040
|
if (config.mode === MODES.PREVIEW) {
|
|
16986
17041
|
return {
|
|
16987
17042
|
showFeedback: true,
|
|
16988
17043
|
isAllCorrect: true,
|
|
16989
17044
|
isSkipped: false,
|
|
16990
17045
|
isAllAnswered: true,
|
|
16991
|
-
resultFeedback:
|
|
17046
|
+
resultFeedback: DROPDOWN_INTERACTION.EMPTY_CHOICE,
|
|
16992
17047
|
answerResults: [],
|
|
16993
17048
|
correctAnswers: [],
|
|
16994
17049
|
sessionAnswer: []
|
|
16995
17050
|
};
|
|
16996
17051
|
}
|
|
16997
17052
|
const selections = state2.data.selected;
|
|
16998
|
-
const allAnswered = isAllAnswered$1(selections);
|
|
17053
|
+
const allAnswered = isAllAnswered$1(selections, renderedDropdownIds);
|
|
16999
17054
|
if (config.mode === MODES.SESSION && !config.isFinished) {
|
|
17000
17055
|
return {
|
|
17001
17056
|
showFeedback: false,
|
|
17002
17057
|
isAllCorrect: false,
|
|
17003
17058
|
isSkipped: false,
|
|
17004
17059
|
isAllAnswered: allAnswered,
|
|
17005
|
-
resultFeedback:
|
|
17060
|
+
resultFeedback: DROPDOWN_INTERACTION.EMPTY_CHOICE,
|
|
17006
17061
|
answerResults: [],
|
|
17007
17062
|
correctAnswers: [],
|
|
17008
|
-
sessionAnswer: getSessionAnswersForDisplay(selections)
|
|
17063
|
+
sessionAnswer: getSessionAnswersForDisplay(selections, renderedDropdownIds)
|
|
17009
17064
|
};
|
|
17010
17065
|
}
|
|
17011
|
-
const isSkipped = isAllSkipped(selections);
|
|
17066
|
+
const isSkipped = isAllSkipped(selections, renderedDropdownIds);
|
|
17067
|
+
const answerResults = calculateAnswerResults(config, selections, renderedDropdownIds);
|
|
17012
17068
|
let validationResult = {
|
|
17013
17069
|
isValid: false,
|
|
17014
|
-
|
|
17070
|
+
score: 0,
|
|
17071
|
+
maxScore: hasRenderedIds(renderedDropdownIds) ? renderedDropdownIds.length : Object.keys(config.options).length,
|
|
17072
|
+
feedback: DROPDOWN_INTERACTION.EMPTY_CHOICE
|
|
17015
17073
|
};
|
|
17016
17074
|
if (allAnswered) {
|
|
17075
|
+
const selectionsToValidate = hasRenderedIds(renderedDropdownIds) ? selections.filter((sel) => renderedDropdownIds.includes(sel.id)) : selections;
|
|
17017
17076
|
validationResult = validateFn({
|
|
17018
|
-
answer:
|
|
17077
|
+
answer: selectionsToValidate,
|
|
17019
17078
|
timestamp: state2.lastModified
|
|
17020
17079
|
});
|
|
17080
|
+
if (hasRenderedIds(renderedDropdownIds)) {
|
|
17081
|
+
const renderedCorrectCount = answerResults.filter(Boolean).length;
|
|
17082
|
+
validationResult.score = renderedCorrectCount;
|
|
17083
|
+
validationResult.maxScore = renderedDropdownIds.length;
|
|
17084
|
+
validationResult.isValid = renderedCorrectCount === renderedDropdownIds.length;
|
|
17085
|
+
validationResult.feedback = renderedCorrectCount === renderedDropdownIds.length ? config.feedback.correct : config.feedback.incorrect;
|
|
17086
|
+
}
|
|
17021
17087
|
} else if (config.mode === MODES.SESSION && config.isFinished && !allAnswered) {
|
|
17022
17088
|
validationResult = {
|
|
17023
17089
|
isValid: false,
|
|
17024
17090
|
score: 0,
|
|
17025
|
-
maxScore: Object.keys(config.options).length,
|
|
17091
|
+
maxScore: hasRenderedIds(renderedDropdownIds) ? renderedDropdownIds.length : Object.keys(config.options).length,
|
|
17026
17092
|
feedback: config.feedback.incorrect
|
|
17027
17093
|
};
|
|
17028
17094
|
}
|
|
17029
|
-
const
|
|
17030
|
-
const
|
|
17031
|
-
const
|
|
17032
|
-
const sessionAnswer = getSessionAnswersForDisplay(selections);
|
|
17095
|
+
const areAllDropdownsCorrect = validationResult.isValid;
|
|
17096
|
+
const correctAnswers = getCorrectAnswersForDisplay(config, selections, answerResults, renderedDropdownIds);
|
|
17097
|
+
const sessionAnswer = getSessionAnswersForDisplay(selections, renderedDropdownIds);
|
|
17033
17098
|
let showFeedback = false;
|
|
17034
17099
|
if (config.mode === MODES.INTERACTIVE) {
|
|
17035
17100
|
showFeedback = allAnswered;
|
|
@@ -17039,10 +17104,10 @@ function calculateDropdownFeedback(state2, config, validateFn) {
|
|
|
17039
17104
|
}
|
|
17040
17105
|
return {
|
|
17041
17106
|
showFeedback,
|
|
17042
|
-
isAllCorrect,
|
|
17107
|
+
isAllCorrect: areAllDropdownsCorrect,
|
|
17043
17108
|
isSkipped,
|
|
17044
17109
|
isAllAnswered: allAnswered,
|
|
17045
|
-
resultFeedback: validationResult.feedback ||
|
|
17110
|
+
resultFeedback: validationResult.feedback || DROPDOWN_INTERACTION.EMPTY_CHOICE,
|
|
17046
17111
|
answerResults,
|
|
17047
17112
|
correctAnswers,
|
|
17048
17113
|
sessionAnswer
|
|
@@ -17072,20 +17137,21 @@ function useDropdownPosition(config) {
|
|
|
17072
17137
|
};
|
|
17073
17138
|
}
|
|
17074
17139
|
var root_1$3 = /* @__PURE__ */ from_html(`<div class="absolute inset-0 bg-transparent z-10"></div>`);
|
|
17075
|
-
var root_2 = /* @__PURE__ */ from_html(`<
|
|
17076
|
-
var
|
|
17077
|
-
var root_6 = /* @__PURE__ */ from_html(`<span class="text-
|
|
17078
|
-
var root_7 = /* @__PURE__ */ from_html(`<span class="
|
|
17079
|
-
var root_8 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span> <span class="sr-only">
|
|
17080
|
-
var
|
|
17081
|
-
var
|
|
17082
|
-
var
|
|
17083
|
-
var
|
|
17084
|
-
var
|
|
17085
|
-
var
|
|
17140
|
+
var root_2 = /* @__PURE__ */ from_html(`<div class="bg-black bg-opacity-5 h-full flex flex-none justify-center items-center"><div class="font-semibold text-base leading-[19px] text-charcoal px-3 flex items-center"> </div></div>`);
|
|
17141
|
+
var root_3$1 = /* @__PURE__ */ from_html(`<span class="text-green-900 mr-2"><span aria-hidden="true"><!></span> <span class="sr-only">Correct</span></span>`);
|
|
17142
|
+
var root_6 = /* @__PURE__ */ from_html(`<span class="text-green-900 mr-2"><span aria-hidden="true"><!></span> <span class="sr-only">Correct</span></span>`);
|
|
17143
|
+
var root_7 = /* @__PURE__ */ from_html(`<span class="text-red-900 mr-2"><span aria-hidden="true"><!></span> <span class="sr-only">Incorrect</span></span>`);
|
|
17144
|
+
var root_8 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span> <span class="sr-only">Close dropdown</span></span>`);
|
|
17145
|
+
var root_9 = /* @__PURE__ */ from_html(`<span class="flex items-center justify-center text-blue-1000"><span aria-hidden="true"><!></span> <span class="sr-only">Open dropdown</span></span>`);
|
|
17146
|
+
var root_12 = /* @__PURE__ */ from_html(`<span class="flex items-center text-green-900" aria-hidden="true"><!></span>`);
|
|
17147
|
+
var root_14 = /* @__PURE__ */ from_html(`<span class="flex items-center text-red-900" aria-hidden="true"><!></span>`);
|
|
17148
|
+
var root_16 = /* @__PURE__ */ from_html(`<span class="flex items-center text-blue-850" aria-hidden="true"><!></span>`);
|
|
17149
|
+
var root_11 = /* @__PURE__ */ from_html(`<li role="option" tabindex="-1"><div class="p-0.5 flex justify-between w-full text-base whitespace-normal"><!> <!></div></li>`);
|
|
17150
|
+
var root_10 = /* @__PURE__ */ from_html(`<ul class="dropdown-menu block" role="listbox" tabindex="-1"></ul>`);
|
|
17151
|
+
var root$1 = /* @__PURE__ */ from_html(`<span class="dropdown inline-block relative align-middle"><span class="sr-only"> </span> <!> <button type="button" aria-haspopup="listbox"><!> <div class="px-4 flex flex-1 min-w-0 align-middle truncate items-center justify-between w-full"><span><!></span> <div class="flex items-center"><!> <!></div></div></button> <!></span>`);
|
|
17086
17152
|
function DropdownContainer($$anchor, $$props) {
|
|
17087
17153
|
push($$props, true);
|
|
17088
|
-
let dropdownId = prop($$props, "dropdownId", 7), dropdownNumber = prop($$props, "dropdownNumber", 7), options = prop($$props, "options", 7), selected = prop($$props, "selected", 7), correctAnswers = prop($$props, "correctAnswers", 23, () => []), isCorrect = prop($$props, "isCorrect", 7, false), isFinished = prop($$props, "isFinished", 7, false), isLocked = prop($$props, "isLocked", 7, false), isDataSaving = prop($$props, "isDataSaving", 7, false), mode = prop($$props, "mode", 7), showFeedback = prop($$props, "showFeedback", 7, false), onselect = prop($$props, "onselect", 7), viewportBuffer = prop($$props, "viewportBuffer", 7, 60);
|
|
17154
|
+
let dropdownId = prop($$props, "dropdownId", 7), dropdownNumber = prop($$props, "dropdownNumber", 7), options = prop($$props, "options", 7), selected = prop($$props, "selected", 7), correctAnswers = prop($$props, "correctAnswers", 23, () => []), isCorrect = prop($$props, "isCorrect", 7, false), isFinished = prop($$props, "isFinished", 7, false), isLocked = prop($$props, "isLocked", 7, false), isDataSaving = prop($$props, "isDataSaving", 7, false), mode = prop($$props, "mode", 7), showFeedback = prop($$props, "showFeedback", 7, false), showNumbering = prop($$props, "showNumbering", 7, true), onselect = prop($$props, "onselect", 7), viewportBuffer = prop($$props, "viewportBuffer", 7, 60);
|
|
17089
17155
|
const dropdownActions = useDropdownState();
|
|
17090
17156
|
const dropdownPosition = useDropdownPosition();
|
|
17091
17157
|
let initializedOptions = /* @__PURE__ */ user_derived(() => {
|
|
@@ -17106,7 +17172,7 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17106
17172
|
});
|
|
17107
17173
|
const canInteract = /* @__PURE__ */ user_derived(() => !isDataSaving() && mode() !== MODES.PREVIEW && !(mode() === MODES.SESSION && isFinished()));
|
|
17108
17174
|
const canToggleAccordion = /* @__PURE__ */ user_derived(() => !isDataSaving());
|
|
17109
|
-
const isMissing = /* @__PURE__ */ user_derived(() => mode() === MODES.SESSION && isFinished() && (selected() ===
|
|
17175
|
+
const isMissing = /* @__PURE__ */ user_derived(() => mode() === MODES.SESSION && isFinished() && (selected() === DROPDOWN_INTERACTION.PLACEHOLDER || selected() === ""));
|
|
17110
17176
|
const getOptionIcon = (option) => {
|
|
17111
17177
|
const isCorrectAnswer = correctAnswers().includes(option);
|
|
17112
17178
|
const isSelected = option === get$1(state$1).selected;
|
|
@@ -17166,7 +17232,7 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17166
17232
|
set(isKeyboardNavigation, false);
|
|
17167
17233
|
set(isFirstNavigation, true);
|
|
17168
17234
|
await tick();
|
|
17169
|
-
if (selected() && selected() !==
|
|
17235
|
+
if (selected() && selected() !== DROPDOWN_INTERACTION.PLACEHOLDER && selected() !== "") {
|
|
17170
17236
|
const currentIndex = get$1(initializedOptions).indexOf(selected());
|
|
17171
17237
|
get$1(state$1).activeIndex = currentIndex >= 0 ? currentIndex : null;
|
|
17172
17238
|
} else {
|
|
@@ -17286,7 +17352,7 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17286
17352
|
}
|
|
17287
17353
|
resizeTimeout = null;
|
|
17288
17354
|
},
|
|
17289
|
-
|
|
17355
|
+
DROPDOWN_INTERACTION.RESIZE_DEBOUNCE_DELAY
|
|
17290
17356
|
);
|
|
17291
17357
|
};
|
|
17292
17358
|
onMount(() => {
|
|
@@ -17323,24 +17389,35 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17323
17389
|
return classes.join(" ");
|
|
17324
17390
|
});
|
|
17325
17391
|
const ariaLabel = /* @__PURE__ */ user_derived(() => {
|
|
17392
|
+
const cleanSelected = useRemoveRichTextHtmlTags(get$1(state$1).selected);
|
|
17326
17393
|
if (mode() === MODES.PREVIEW) {
|
|
17327
|
-
|
|
17394
|
+
const parts2 = ["Correct answer"];
|
|
17395
|
+
if (showNumbering()) parts2.push(`Item number ${dropdownNumber()}`);
|
|
17396
|
+
parts2.push(cleanSelected);
|
|
17397
|
+
return parts2.filter(Boolean).join(", ");
|
|
17328
17398
|
}
|
|
17329
17399
|
if (mode() === MODES.SESSION && isFinished()) {
|
|
17330
17400
|
const correctness = isCorrect() ? "Correct" : "Incorrect";
|
|
17331
|
-
|
|
17401
|
+
const parts2 = [`Student's answer (${correctness})`];
|
|
17402
|
+
if (showNumbering()) parts2.push(`Item number ${dropdownNumber()}`);
|
|
17403
|
+
parts2.push(cleanSelected);
|
|
17404
|
+
return parts2.filter(Boolean).join(", ");
|
|
17332
17405
|
}
|
|
17333
|
-
|
|
17406
|
+
const parts = [];
|
|
17407
|
+
if (showNumbering()) parts.push(`Item number ${dropdownNumber()}`);
|
|
17408
|
+
parts.push(cleanSelected);
|
|
17409
|
+
return parts.filter(Boolean).join(", ");
|
|
17334
17410
|
});
|
|
17335
17411
|
const getOptionAriaLabel = (option, index2) => {
|
|
17336
17412
|
const optionNum = index2 + 1;
|
|
17337
17413
|
const isSelected = option === get$1(state$1).selected;
|
|
17414
|
+
const cleanOption = useRemoveRichTextHtmlTags(option);
|
|
17338
17415
|
if (showFeedback()) {
|
|
17339
17416
|
const isCorrectAnswer = correctAnswers().includes(option);
|
|
17340
17417
|
const correctness = isCorrectAnswer ? "correct" : "incorrect";
|
|
17341
|
-
return isSelected ? `Selected option ${
|
|
17418
|
+
return isSelected ? `Selected option ${cleanOption} ${correctness}` : `Option ${optionNum} ${cleanOption} ${correctness}`;
|
|
17342
17419
|
}
|
|
17343
|
-
return isSelected ? `Selected option ${
|
|
17420
|
+
return isSelected ? `Selected option ${cleanOption}` : `Option ${optionNum} ${cleanOption}`;
|
|
17344
17421
|
};
|
|
17345
17422
|
const isCurrentOption = (index2) => {
|
|
17346
17423
|
return get$1(state$1).isOpen && get$1(isKeyboardNavigation) && get$1(state$1).activeIndex === index2;
|
|
@@ -17426,6 +17503,13 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17426
17503
|
showFeedback($$value);
|
|
17427
17504
|
flushSync();
|
|
17428
17505
|
},
|
|
17506
|
+
get showNumbering() {
|
|
17507
|
+
return showNumbering();
|
|
17508
|
+
},
|
|
17509
|
+
set showNumbering($$value = true) {
|
|
17510
|
+
showNumbering($$value);
|
|
17511
|
+
flushSync();
|
|
17512
|
+
},
|
|
17429
17513
|
get onselect() {
|
|
17430
17514
|
return onselect();
|
|
17431
17515
|
},
|
|
@@ -17462,24 +17546,34 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17462
17546
|
get$1(state$1).isOpen ? handleCloseMenu() : handleOpenMenu();
|
|
17463
17547
|
};
|
|
17464
17548
|
button.__focusout = handleFocusOut;
|
|
17465
|
-
var
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17549
|
+
var node_1 = child(button);
|
|
17550
|
+
{
|
|
17551
|
+
var consequent_1 = ($$anchor2) => {
|
|
17552
|
+
var div_1 = root_2();
|
|
17553
|
+
var div_2 = child(div_1);
|
|
17554
|
+
var text_1 = child(div_2, true);
|
|
17555
|
+
reset(div_2);
|
|
17556
|
+
reset(div_1);
|
|
17557
|
+
template_effect(() => set_text(text_1, dropdownNumber()));
|
|
17558
|
+
append($$anchor2, div_1);
|
|
17559
|
+
};
|
|
17560
|
+
if_block(node_1, ($$render) => {
|
|
17561
|
+
if (showNumbering()) $$render(consequent_1);
|
|
17562
|
+
});
|
|
17563
|
+
}
|
|
17564
|
+
var div_3 = sibling(node_1, 2);
|
|
17471
17565
|
var span_2 = child(div_3);
|
|
17472
|
-
var
|
|
17473
|
-
html(
|
|
17566
|
+
var node_2 = child(span_2);
|
|
17567
|
+
html(node_2, () => get$1(state$1).selected === "" ? DROPDOWN_INTERACTION.PLACEHOLDER : get$1(state$1).selected);
|
|
17474
17568
|
reset(span_2);
|
|
17475
17569
|
var div_4 = sibling(span_2, 2);
|
|
17476
|
-
var
|
|
17570
|
+
var node_3 = child(div_4);
|
|
17477
17571
|
{
|
|
17478
|
-
var
|
|
17479
|
-
var span_3 =
|
|
17572
|
+
var consequent_2 = ($$anchor2) => {
|
|
17573
|
+
var span_3 = root_3$1();
|
|
17480
17574
|
var span_4 = child(span_3);
|
|
17481
|
-
var
|
|
17482
|
-
SvgLoader(
|
|
17575
|
+
var node_4 = child(span_4);
|
|
17576
|
+
SvgLoader(node_4, { svgName: "successSolid", className: "correct-icon" });
|
|
17483
17577
|
reset(span_4);
|
|
17484
17578
|
next$1(2);
|
|
17485
17579
|
reset(span_3);
|
|
@@ -17487,61 +17581,61 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17487
17581
|
};
|
|
17488
17582
|
var alternate_1 = ($$anchor2) => {
|
|
17489
17583
|
var fragment = comment();
|
|
17490
|
-
var
|
|
17584
|
+
var node_5 = first_child(fragment);
|
|
17491
17585
|
{
|
|
17492
|
-
var
|
|
17586
|
+
var consequent_4 = ($$anchor3) => {
|
|
17493
17587
|
var fragment_1 = comment();
|
|
17494
|
-
var
|
|
17588
|
+
var node_6 = first_child(fragment_1);
|
|
17495
17589
|
{
|
|
17496
|
-
var
|
|
17497
|
-
var span_5 =
|
|
17590
|
+
var consequent_3 = ($$anchor4) => {
|
|
17591
|
+
var span_5 = root_6();
|
|
17498
17592
|
var span_6 = child(span_5);
|
|
17499
|
-
var
|
|
17500
|
-
SvgLoader(
|
|
17593
|
+
var node_7 = child(span_6);
|
|
17594
|
+
SvgLoader(node_7, { svgName: "successSolid", className: "correct-icon" });
|
|
17501
17595
|
reset(span_6);
|
|
17502
17596
|
next$1(2);
|
|
17503
17597
|
reset(span_5);
|
|
17504
17598
|
append($$anchor4, span_5);
|
|
17505
17599
|
};
|
|
17506
17600
|
var alternate = ($$anchor4) => {
|
|
17507
|
-
var span_7 =
|
|
17601
|
+
var span_7 = root_7();
|
|
17508
17602
|
var span_8 = child(span_7);
|
|
17509
|
-
var
|
|
17510
|
-
SvgLoader(
|
|
17603
|
+
var node_8 = child(span_8);
|
|
17604
|
+
SvgLoader(node_8, { svgName: "errorSolid", className: "incorrect-icon" });
|
|
17511
17605
|
reset(span_8);
|
|
17512
17606
|
next$1(2);
|
|
17513
17607
|
reset(span_7);
|
|
17514
17608
|
append($$anchor4, span_7);
|
|
17515
17609
|
};
|
|
17516
|
-
if_block(
|
|
17517
|
-
if (isCorrect()) $$render(
|
|
17610
|
+
if_block(node_6, ($$render) => {
|
|
17611
|
+
if (isCorrect()) $$render(consequent_3);
|
|
17518
17612
|
else $$render(alternate, false);
|
|
17519
17613
|
});
|
|
17520
17614
|
}
|
|
17521
17615
|
append($$anchor3, fragment_1);
|
|
17522
17616
|
};
|
|
17523
17617
|
if_block(
|
|
17524
|
-
|
|
17618
|
+
node_5,
|
|
17525
17619
|
($$render) => {
|
|
17526
|
-
if (showFeedback() && !get$1(isMissing)) $$render(
|
|
17620
|
+
if (showFeedback() && !get$1(isMissing)) $$render(consequent_4);
|
|
17527
17621
|
},
|
|
17528
17622
|
true
|
|
17529
17623
|
);
|
|
17530
17624
|
}
|
|
17531
17625
|
append($$anchor2, fragment);
|
|
17532
17626
|
};
|
|
17533
|
-
if_block(
|
|
17534
|
-
if (mode() === MODES.PREVIEW) $$render(
|
|
17627
|
+
if_block(node_3, ($$render) => {
|
|
17628
|
+
if (mode() === MODES.PREVIEW) $$render(consequent_2);
|
|
17535
17629
|
else $$render(alternate_1, false);
|
|
17536
17630
|
});
|
|
17537
17631
|
}
|
|
17538
|
-
var
|
|
17632
|
+
var node_9 = sibling(node_3, 2);
|
|
17539
17633
|
{
|
|
17540
|
-
var
|
|
17541
|
-
var span_9 =
|
|
17634
|
+
var consequent_5 = ($$anchor2) => {
|
|
17635
|
+
var span_9 = root_8();
|
|
17542
17636
|
var span_10 = child(span_9);
|
|
17543
|
-
var
|
|
17544
|
-
SvgLoader(
|
|
17637
|
+
var node_10 = child(span_10);
|
|
17638
|
+
SvgLoader(node_10, {
|
|
17545
17639
|
svgName: "smallChevronUp",
|
|
17546
17640
|
className: "collapse-icon",
|
|
17547
17641
|
width: 12,
|
|
@@ -17553,10 +17647,10 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17553
17647
|
append($$anchor2, span_9);
|
|
17554
17648
|
};
|
|
17555
17649
|
var alternate_2 = ($$anchor2) => {
|
|
17556
|
-
var span_11 =
|
|
17650
|
+
var span_11 = root_9();
|
|
17557
17651
|
var span_12 = child(span_11);
|
|
17558
|
-
var
|
|
17559
|
-
SvgLoader(
|
|
17652
|
+
var node_11 = child(span_12);
|
|
17653
|
+
SvgLoader(node_11, {
|
|
17560
17654
|
svgName: "smallChevronDown",
|
|
17561
17655
|
className: "expand-icon",
|
|
17562
17656
|
width: 12,
|
|
@@ -17567,8 +17661,8 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17567
17661
|
reset(span_11);
|
|
17568
17662
|
append($$anchor2, span_11);
|
|
17569
17663
|
};
|
|
17570
|
-
if_block(
|
|
17571
|
-
if (get$1(state$1).isOpen) $$render(
|
|
17664
|
+
if_block(node_9, ($$render) => {
|
|
17665
|
+
if (get$1(state$1).isOpen) $$render(consequent_5);
|
|
17572
17666
|
else $$render(alternate_2, false);
|
|
17573
17667
|
});
|
|
17574
17668
|
}
|
|
@@ -17576,16 +17670,16 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17576
17670
|
reset(div_3);
|
|
17577
17671
|
reset(button);
|
|
17578
17672
|
bind_this(button, ($$value) => set(buttonRef, $$value), () => get$1(buttonRef));
|
|
17579
|
-
var
|
|
17673
|
+
var node_12 = sibling(button, 2);
|
|
17580
17674
|
{
|
|
17581
|
-
var
|
|
17582
|
-
var ul =
|
|
17675
|
+
var consequent_9 = ($$anchor2) => {
|
|
17676
|
+
var ul = root_10();
|
|
17583
17677
|
each(ul, 21, () => get$1(initializedOptions), index, ($$anchor3, option, index2) => {
|
|
17584
17678
|
const iconType = /* @__PURE__ */ user_derived(() => getOptionIcon(get$1(option)));
|
|
17585
17679
|
const showCurrentOption = /* @__PURE__ */ user_derived(() => isCurrentOption(index2));
|
|
17586
17680
|
const showHoverOption = /* @__PURE__ */ user_derived(() => shouldShowHover(index2));
|
|
17587
17681
|
const optionAriaLabel = /* @__PURE__ */ user_derived(() => getOptionAriaLabel(get$1(option), index2));
|
|
17588
|
-
var li =
|
|
17682
|
+
var li = root_11();
|
|
17589
17683
|
li.__mousedown = (e2) => e2.preventDefault();
|
|
17590
17684
|
li.__click = async (e2) => {
|
|
17591
17685
|
e2.preventDefault();
|
|
@@ -17593,11 +17687,11 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17593
17687
|
await handleSelect(get$1(option));
|
|
17594
17688
|
};
|
|
17595
17689
|
var div_5 = child(li);
|
|
17596
|
-
var
|
|
17690
|
+
var node_13 = child(div_5);
|
|
17597
17691
|
{
|
|
17598
17692
|
let $0 = /* @__PURE__ */ user_derived(() => get$1(showHoverOption) && get$1(canInteract) ? "hover-option" : "");
|
|
17599
17693
|
let $1 = /* @__PURE__ */ user_derived(() => get$1(showCurrentOption) ? "current-option" : "");
|
|
17600
|
-
CommonStringToHtml(
|
|
17694
|
+
CommonStringToHtml(node_13, {
|
|
17601
17695
|
get htmlString() {
|
|
17602
17696
|
return get$1(option);
|
|
17603
17697
|
},
|
|
@@ -17608,41 +17702,41 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17608
17702
|
}
|
|
17609
17703
|
});
|
|
17610
17704
|
}
|
|
17611
|
-
var
|
|
17705
|
+
var node_14 = sibling(node_13, 2);
|
|
17612
17706
|
{
|
|
17613
|
-
var
|
|
17614
|
-
var span_13 =
|
|
17615
|
-
var
|
|
17616
|
-
SvgLoader(
|
|
17707
|
+
var consequent_6 = ($$anchor4) => {
|
|
17708
|
+
var span_13 = root_12();
|
|
17709
|
+
var node_15 = child(span_13);
|
|
17710
|
+
SvgLoader(node_15, { svgName: "successSolid", className: "correct-icon" });
|
|
17617
17711
|
reset(span_13);
|
|
17618
17712
|
append($$anchor4, span_13);
|
|
17619
17713
|
};
|
|
17620
17714
|
var alternate_4 = ($$anchor4) => {
|
|
17621
17715
|
var fragment_2 = comment();
|
|
17622
|
-
var
|
|
17716
|
+
var node_16 = first_child(fragment_2);
|
|
17623
17717
|
{
|
|
17624
|
-
var
|
|
17625
|
-
var span_14 =
|
|
17626
|
-
var
|
|
17627
|
-
SvgLoader(
|
|
17718
|
+
var consequent_7 = ($$anchor5) => {
|
|
17719
|
+
var span_14 = root_14();
|
|
17720
|
+
var node_17 = child(span_14);
|
|
17721
|
+
SvgLoader(node_17, { svgName: "errorSolid", className: "incorrect-icon" });
|
|
17628
17722
|
reset(span_14);
|
|
17629
17723
|
append($$anchor5, span_14);
|
|
17630
17724
|
};
|
|
17631
17725
|
var alternate_3 = ($$anchor5) => {
|
|
17632
17726
|
var fragment_3 = comment();
|
|
17633
|
-
var
|
|
17727
|
+
var node_18 = first_child(fragment_3);
|
|
17634
17728
|
{
|
|
17635
|
-
var
|
|
17636
|
-
var span_15 =
|
|
17637
|
-
var
|
|
17638
|
-
SvgLoader(
|
|
17729
|
+
var consequent_8 = ($$anchor6) => {
|
|
17730
|
+
var span_15 = root_16();
|
|
17731
|
+
var node_19 = child(span_15);
|
|
17732
|
+
SvgLoader(node_19, { svgName: "successSolid", className: "correct-icon" });
|
|
17639
17733
|
reset(span_15);
|
|
17640
17734
|
append($$anchor6, span_15);
|
|
17641
17735
|
};
|
|
17642
17736
|
if_block(
|
|
17643
|
-
|
|
17737
|
+
node_18,
|
|
17644
17738
|
($$render) => {
|
|
17645
|
-
if (get$1(iconType) === "selected") $$render(
|
|
17739
|
+
if (get$1(iconType) === "selected") $$render(consequent_8);
|
|
17646
17740
|
},
|
|
17647
17741
|
true
|
|
17648
17742
|
);
|
|
@@ -17650,9 +17744,9 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17650
17744
|
append($$anchor5, fragment_3);
|
|
17651
17745
|
};
|
|
17652
17746
|
if_block(
|
|
17653
|
-
|
|
17747
|
+
node_16,
|
|
17654
17748
|
($$render) => {
|
|
17655
|
-
if (get$1(iconType) === "incorrect") $$render(
|
|
17749
|
+
if (get$1(iconType) === "incorrect") $$render(consequent_7);
|
|
17656
17750
|
else $$render(alternate_3, false);
|
|
17657
17751
|
},
|
|
17658
17752
|
true
|
|
@@ -17660,8 +17754,8 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17660
17754
|
}
|
|
17661
17755
|
append($$anchor4, fragment_2);
|
|
17662
17756
|
};
|
|
17663
|
-
if_block(
|
|
17664
|
-
if (get$1(iconType) === "correct") $$render(
|
|
17757
|
+
if_block(node_14, ($$render) => {
|
|
17758
|
+
if (get$1(iconType) === "correct") $$render(consequent_6);
|
|
17665
17759
|
else $$render(alternate_4, false);
|
|
17666
17760
|
});
|
|
17667
17761
|
}
|
|
@@ -17686,8 +17780,8 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17686
17780
|
});
|
|
17687
17781
|
append($$anchor2, ul);
|
|
17688
17782
|
};
|
|
17689
|
-
if_block(
|
|
17690
|
-
if (get$1(state$1).isOpen && get$1(initializedOptions).length > 0) $$render(
|
|
17783
|
+
if_block(node_12, ($$render) => {
|
|
17784
|
+
if (get$1(state$1).isOpen && get$1(initializedOptions).length > 0) $$render(consequent_9);
|
|
17691
17785
|
});
|
|
17692
17786
|
}
|
|
17693
17787
|
reset(span);
|
|
@@ -17701,8 +17795,7 @@ function DropdownContainer($$anchor, $$props) {
|
|
|
17701
17795
|
set_attribute(button, "aria-labelledby", labelId);
|
|
17702
17796
|
set_attribute(button, "aria-controls", listId);
|
|
17703
17797
|
set_attribute(button, "aria-activedescendant", get$1(state$1).activeIndex !== null ? `${listId}-option-${get$1(state$1).activeIndex}` : void 0);
|
|
17704
|
-
|
|
17705
|
-
set_class(span_2, 1, `truncate mr-2 text-base ${get$1(state$1).selected === "Select Answer" || get$1(state$1).selected === "" ? "text-gray-860" : "text-charcoal"}`);
|
|
17798
|
+
set_class(span_2, 1, `truncate mr-2 text-base ${get$1(state$1).selected === DROPDOWN_INTERACTION.PLACEHOLDER || get$1(state$1).selected === "" ? "text-gray-860" : "text-charcoal"}`);
|
|
17706
17799
|
});
|
|
17707
17800
|
append($$anchor, span);
|
|
17708
17801
|
return pop($$exports);
|
|
@@ -17722,6 +17815,7 @@ create_custom_element(
|
|
|
17722
17815
|
isDataSaving: {},
|
|
17723
17816
|
mode: {},
|
|
17724
17817
|
showFeedback: {},
|
|
17818
|
+
showNumbering: {},
|
|
17725
17819
|
onselect: {},
|
|
17726
17820
|
viewportBuffer: {}
|
|
17727
17821
|
},
|
|
@@ -17741,14 +17835,31 @@ function DropdownInteractionContent($$anchor, $$props) {
|
|
|
17741
17835
|
const pTags = config().text.prompt.match(pTagRegex);
|
|
17742
17836
|
return pTags && pTags.length > 0 ? pTags : [config().text.prompt];
|
|
17743
17837
|
});
|
|
17838
|
+
const renderedDropdownIds = /* @__PURE__ */ user_derived(() => {
|
|
17839
|
+
const ids = [];
|
|
17840
|
+
get$1(promptLines).forEach((line) => {
|
|
17841
|
+
const parts = dropdownParser.parseText(line);
|
|
17842
|
+
parts.forEach((part) => {
|
|
17843
|
+
if (part.type === "dropdown" && part.id) {
|
|
17844
|
+
ids.push(part.id);
|
|
17845
|
+
}
|
|
17846
|
+
});
|
|
17847
|
+
});
|
|
17848
|
+
return ids;
|
|
17849
|
+
});
|
|
17850
|
+
const shouldShowNumbering = /* @__PURE__ */ user_derived(() => get$1(renderedDropdownIds).length > 1);
|
|
17744
17851
|
const previewSelections = /* @__PURE__ */ user_derived(() => config().mode === MODES.PREVIEW ? getDropdownPreviewSelections(config()) : []);
|
|
17745
17852
|
const shuffledOptionsCache = /* @__PURE__ */ new Map();
|
|
17746
17853
|
const getShuffledOptions = (dropdownId, options) => {
|
|
17747
17854
|
if (shuffledOptionsCache.has(dropdownId)) {
|
|
17748
17855
|
return shuffledOptionsCache.get(dropdownId);
|
|
17749
17856
|
}
|
|
17857
|
+
if (config().mode === MODES.PREVIEW) {
|
|
17858
|
+
shuffledOptionsCache.set(dropdownId, [...options]);
|
|
17859
|
+
return [...options];
|
|
17860
|
+
}
|
|
17750
17861
|
const selectedValue = getSelectedValue(dropdownId);
|
|
17751
|
-
if (
|
|
17862
|
+
if (selectedValue !== DROPDOWN_INTERACTION.PLACEHOLDER && selectedValue !== "") {
|
|
17752
17863
|
shuffledOptionsCache.set(dropdownId, [...options]);
|
|
17753
17864
|
return [...options];
|
|
17754
17865
|
}
|
|
@@ -17768,11 +17879,11 @@ function DropdownInteractionContent($$anchor, $$props) {
|
|
|
17768
17879
|
const getSelectedValue = (dropdownId) => {
|
|
17769
17880
|
if (config().mode === MODES.PREVIEW) {
|
|
17770
17881
|
const previewItem = get$1(previewSelections).find((item) => item.id === dropdownId);
|
|
17771
|
-
return previewItem?.choice || config().correctAnswer[dropdownId]?.[0] ||
|
|
17882
|
+
return previewItem?.choice || config().correctAnswer[dropdownId]?.[0] || DROPDOWN_INTERACTION.PLACEHOLDER;
|
|
17772
17883
|
}
|
|
17773
17884
|
const selection = state2().data.selected.find((item) => item.id === dropdownId);
|
|
17774
17885
|
const value = selection?.choice || "";
|
|
17775
|
-
return value === "" ?
|
|
17886
|
+
return value === "" ? DROPDOWN_INTERACTION.PLACEHOLDER : value;
|
|
17776
17887
|
};
|
|
17777
17888
|
const getCorrectAnswers = (dropdownId) => {
|
|
17778
17889
|
return config().correctAnswer[dropdownId] || [];
|
|
@@ -17784,7 +17895,7 @@ function DropdownInteractionContent($$anchor, $$props) {
|
|
|
17784
17895
|
};
|
|
17785
17896
|
const isDropdownCorrect = (dropdownId) => {
|
|
17786
17897
|
const selectedValue = getSelectedValue(dropdownId);
|
|
17787
|
-
if (selectedValue ===
|
|
17898
|
+
if (selectedValue === DROPDOWN_INTERACTION.PLACEHOLDER || selectedValue === "") return false;
|
|
17788
17899
|
const correctAnswers = getCorrectAnswers(dropdownId);
|
|
17789
17900
|
return correctAnswers.length > 0 && correctAnswers.includes(selectedValue);
|
|
17790
17901
|
};
|
|
@@ -17877,6 +17988,9 @@ function DropdownInteractionContent($$anchor, $$props) {
|
|
|
17877
17988
|
get showFeedback() {
|
|
17878
17989
|
return showFeedback();
|
|
17879
17990
|
},
|
|
17991
|
+
get showNumbering() {
|
|
17992
|
+
return get$1(shouldShowNumbering);
|
|
17993
|
+
},
|
|
17880
17994
|
onselect: (value) => handleSelect(get$1(part).id, value)
|
|
17881
17995
|
});
|
|
17882
17996
|
}
|
|
@@ -18022,11 +18136,26 @@ function DropdownComponent($$anchor, $$props) {
|
|
|
18022
18136
|
throw new Error("Failed to initialize Dropdown state");
|
|
18023
18137
|
}
|
|
18024
18138
|
let interactionState = /* @__PURE__ */ state(proxy(initialState));
|
|
18025
|
-
|
|
18139
|
+
const dropdownParser = useDropdown(config().text.prompt, config().options);
|
|
18140
|
+
const pTagRegex = /<p[^>]*>.*?<\/p>/gi;
|
|
18141
|
+
const renderedDropdownIds = /* @__PURE__ */ user_derived(() => {
|
|
18142
|
+
const pTags = config().text.prompt.match(pTagRegex);
|
|
18143
|
+
const promptLines = pTags && pTags.length > 0 ? pTags : [config().text.prompt];
|
|
18144
|
+
const ids = [];
|
|
18145
|
+
promptLines.forEach((line) => {
|
|
18146
|
+
const parts = dropdownParser.parseText(line);
|
|
18147
|
+
parts.forEach((part) => {
|
|
18148
|
+
if (part.type === "dropdown" && part.id) {
|
|
18149
|
+
ids.push(part.id);
|
|
18150
|
+
}
|
|
18151
|
+
});
|
|
18152
|
+
});
|
|
18153
|
+
return ids;
|
|
18154
|
+
});
|
|
18155
|
+
let feedbackState = /* @__PURE__ */ user_derived(() => calculateDropdownFeedback(get$1(interactionState), config(), api().validate || (() => ({ isValid: false })), get$1(renderedDropdownIds)));
|
|
18026
18156
|
let isInteractiveMode2 = /* @__PURE__ */ user_derived(() => config().mode === MODES.INTERACTIVE);
|
|
18027
18157
|
let isSessionNotFinished = /* @__PURE__ */ user_derived(() => config().mode === MODES.SESSION && !config().isFinished);
|
|
18028
18158
|
let saveTimer = null;
|
|
18029
|
-
const SAVE_DELAY = 500;
|
|
18030
18159
|
const handleSelection = async (event2) => {
|
|
18031
18160
|
try {
|
|
18032
18161
|
const { id, value } = event2.detail;
|
|
@@ -18038,6 +18167,9 @@ function DropdownComponent($$anchor, $$props) {
|
|
|
18038
18167
|
return;
|
|
18039
18168
|
}
|
|
18040
18169
|
set(interactionState, result.newState, true);
|
|
18170
|
+
if (get$1(isInteractiveMode2)) {
|
|
18171
|
+
handleInteractiveModeInteraction();
|
|
18172
|
+
}
|
|
18041
18173
|
api().onStateChange?.(get$1(interactionState));
|
|
18042
18174
|
onstateChange()?.(new CustomEvent("stateChange", {
|
|
18043
18175
|
detail: {
|
|
@@ -18045,13 +18177,14 @@ function DropdownComponent($$anchor, $$props) {
|
|
|
18045
18177
|
serialized: api().serialize?.(get$1(interactionState))
|
|
18046
18178
|
}
|
|
18047
18179
|
}));
|
|
18048
|
-
if (get$1(isInteractiveMode2)) {
|
|
18049
|
-
handleInteractiveModeInteraction();
|
|
18050
|
-
}
|
|
18051
18180
|
if (get$1(isSessionNotFinished)) {
|
|
18052
18181
|
if (saveTimer) {
|
|
18053
18182
|
clearTimeout(saveTimer);
|
|
18054
18183
|
}
|
|
18184
|
+
const hasValidSelection = get$1(interactionState).data.selected.some((item) => item.choice !== "" && item.choice !== DROPDOWN_INTERACTION.PLACEHOLDER);
|
|
18185
|
+
if (!hasValidSelection) {
|
|
18186
|
+
return;
|
|
18187
|
+
}
|
|
18055
18188
|
saveTimer = setTimeout(
|
|
18056
18189
|
async () => {
|
|
18057
18190
|
try {
|
|
@@ -18064,18 +18197,25 @@ function DropdownComponent($$anchor, $$props) {
|
|
|
18064
18197
|
saveTimer = null;
|
|
18065
18198
|
}
|
|
18066
18199
|
},
|
|
18067
|
-
|
|
18200
|
+
DROPDOWN_INTERACTION.SAVE_DEBOUNCE_DELAY
|
|
18068
18201
|
);
|
|
18069
18202
|
}
|
|
18070
18203
|
} catch (error) {
|
|
18071
18204
|
}
|
|
18072
18205
|
};
|
|
18073
18206
|
const handleInteractiveModeInteraction = () => {
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18207
|
+
const allRenderedAnswered = get$1(renderedDropdownIds).every((id) => {
|
|
18208
|
+
const selection = get$1(interactionState).data.selected.find((item) => item.id === id);
|
|
18209
|
+
return selection && selection.choice !== "" && selection.choice !== DROPDOWN_INTERACTION.PLACEHOLDER;
|
|
18210
|
+
});
|
|
18211
|
+
set(
|
|
18212
|
+
interactionState,
|
|
18213
|
+
interactionUtils.updateState(get$1(interactionState), {
|
|
18214
|
+
interactiveHasAnswered: allRenderedAnswered,
|
|
18215
|
+
showFeedback: allRenderedAnswered
|
|
18216
|
+
}),
|
|
18217
|
+
true
|
|
18218
|
+
);
|
|
18079
18219
|
};
|
|
18080
18220
|
onMount(() => {
|
|
18081
18221
|
return () => {
|