lms/public/build/assets/fill-blank-form-D0Ep5llL.js
2025-12-15 12:26:23 +01:00

2 lines
1.9 KiB
JavaScript

import{r as u,j as s,bm as w,T as j}from"./vendor-BKmmeuxg.js";import{I as f}from"./input-error-LaPr_4wd.js";import{B as i}from"./button-BpNwv2aE.js";import{I as v}from"./input-DM0goJrn.js";import{L as l}from"./label-HmIcv5Yx.js";import"./utils-DxSsnXxD.js";import"./index-WW_1X1qx.js";const C=({data:c,setData:a,errors:d})=>{var o;const t=((o=c.options)==null?void 0:o.answers)||[];u.useEffect(()=>{t.length===0&&a("options",{answers:[""]})},[]);const m=()=>{const r=[...t,""];a("options",{answers:r})},p=r=>{const e=t.filter((n,x)=>x!==r);a("options",{answers:e})},h=(r,e)=>{const n=[...t];n[r]=e,a("options",{answers:n})};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(l,{children:"Instructions"}),s.jsxs("div",{className:"p-3 bg-blue-50 rounded-md text-sm text-blue-900",children:[s.jsx("p",{className:"font-medium mb-1",children:"How to use fill-in-the-blank questions:"}),s.jsx("p",{children:"1. Write your question in the title field above"}),s.jsx("p",{children:"2. Use underscores (___) or brackets [blank] to mark where students should fill in answers"}),s.jsx("p",{children:"3. Add the correct answer(s) below"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(l,{children:"Accepted Answers *"}),s.jsxs(i,{type:"button",variant:"outline",size:"sm",onClick:m,children:[s.jsx(w,{className:"h-4 w-4"}),"Add Alternative Answer"]})]}),s.jsx("p",{className:"text-sm text-gray-600",children:"Add multiple variations if there are different ways to answer correctly"}),t.map((r,e)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(v,{placeholder:`Correct answer ${e+1}`,value:r,onChange:n=>h(e,n.target.value)})}),t.length>1&&s.jsx(i,{type:"button",variant:"ghost",size:"sm",onClick:()=>p(e),className:"text-red-600",children:s.jsx(j,{className:"h-4 w-4"})})]},e))]}),s.jsx(f,{message:d.options})]})};export{C as default};