@superbuilders/incept-renderer 0.1.7 → 0.1.11

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.
@@ -345,7 +345,7 @@ var choiceIndicatorVariants = cva(
345
345
  "data-[state=unchecked]:bg-background data-[state=unchecked]:border-2 data-[state=unchecked]:border-input data-[state=unchecked]:text-muted-foreground",
346
346
  "data-[state=checked]:border-2 data-[state=checked]:border-[var(--choice-complement)] data-[state=checked]:text-[var(--choice-foreground)]",
347
347
  "data-[filled=true]:data-[state=checked]:bg-[var(--choice-complement)]",
348
- "data-[filled=true]:data-[state=checked]:shadow-[inset_0_0_0_2px_rgb(255_255_255)] dark:data-[filled=true]:data-[state=checked]:shadow-[inset_0_0_0_2px_rgb(255_255_255)]",
348
+ "data-[filled=true]:data-[state=checked]:shadow-[inset_0_0_0_3px_rgb(255_255_255)] dark:data-[filled=true]:data-[state=checked]:shadow-[inset_0_0_0_3px_hsl(var(--background))]",
349
349
  "focus-visible:ring-[var(--choice-complement)] focus-visible:ring-[3px]",
350
350
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive"
351
351
  ],
@@ -374,31 +374,38 @@ function ChoiceIndicator({
374
374
  letter,
375
375
  type = "radio",
376
376
  showLetter = true,
377
- ...props
377
+ id,
378
+ value,
379
+ checked,
380
+ onCheckedChange,
381
+ disabled
378
382
  }) {
379
383
  const baseClassName = cn(choiceIndicatorVariants({ palette }), className);
380
384
  if (type === "checkbox") {
381
- const checkboxProps = props;
382
385
  return /* @__PURE__ */ jsx(
383
386
  CheckboxPrimitive.Root,
384
387
  {
385
388
  "data-slot": "choice-indicator",
386
389
  "data-palette": palette,
387
- "data-filled": !showLetter,
390
+ "data-filled": !showLetter ? "true" : void 0,
388
391
  className: baseClassName,
389
- ...checkboxProps,
392
+ id,
393
+ checked,
394
+ onCheckedChange,
395
+ disabled,
390
396
  children: showLetter && /* @__PURE__ */ jsx("span", { className: "data-[state=unchecked]:block data-[state=checked]:hidden", children: letter })
391
397
  }
392
398
  );
393
399
  }
394
- const radioProps = props;
395
400
  return /* @__PURE__ */ jsx(
396
401
  RadioGroupPrimitive.Item,
397
402
  {
398
403
  "data-slot": "choice-indicator",
399
404
  "data-palette": palette,
400
405
  className: baseClassName,
401
- ...radioProps,
406
+ id,
407
+ value: value ?? "",
408
+ disabled,
402
409
  children: letter
403
410
  }
404
411
  );
@@ -615,18 +622,18 @@ function ChoiceInteractionRenderer({
615
622
  if (!isImagesOnly) return "space-y-2";
616
623
  switch (choiceCount) {
617
624
  case 4:
618
- return "grid grid-cols-2 gap-4";
625
+ return "qti-image-grid-4";
619
626
  case 3:
620
- return "grid grid-cols-3 gap-4";
627
+ return "qti-image-grid-3";
621
628
  case 2:
622
- return "max-w-3xl mx-auto grid grid-cols-2 gap-6";
629
+ return "qti-image-grid-2";
623
630
  default:
624
- return "grid grid-cols-2 md:grid-cols-3 gap-4";
631
+ return "qti-image-grid-many";
625
632
  }
626
633
  }, [isImagesOnly, choiceCount]);
627
634
  const imageCardClass = React3.useMemo(() => {
628
635
  if (!isImagesOnly) return "";
629
- return choiceCount === 2 ? "justify-center text-center [&_img]:max-h-52 md:[&_img]:max-h-60 ![&_img]:w-auto ![&_img]:h-auto ![&_img]:max-w-full ![&_img]:block [&_img]:mx-auto min-h-[220px] px-8 py-8" : "justify-center text-center [&_img]:max-h-40 md:[&_img]:max-h-48 ![&_img]:w-auto ![&_img]:h-auto ![&_img]:max-w-full ![&_img]:block [&_img]:mx-auto min-h-[180px]";
636
+ return choiceCount === 2 ? "qti-image-card qti-image-card-large" : "qti-image-card";
630
637
  }, [isImagesOnly, choiceCount]);
631
638
  const handleSingleChoice = (value) => {
632
639
  if (!disabled && onAnswerSelect) {
@@ -1751,14 +1758,16 @@ function SortableItem({
1751
1758
  style,
1752
1759
  ...attributes,
1753
1760
  ...listeners,
1761
+ "data-disabled": disabled,
1762
+ "data-dragging": isDragging,
1754
1763
  className: cn(
1755
- "bg-background border rounded-lg shadow-sm touch-none select-none",
1764
+ "qti-order-item",
1756
1765
  // Styling differs based on orientation
1757
- isHorizontal ? "px-4 py-2 min-w-[100px] flex items-center justify-center text-center" : "p-4 w-full flex items-center gap-3",
1758
- disabled ? "cursor-default opacity-90 bg-muted/50" : "cursor-grab active:cursor-grabbing hover:border-macaw/50 hover:shadow-md"
1766
+ isHorizontal ? "min-w-[100px] flex items-center justify-center text-center" : "w-full flex items-center gap-3",
1767
+ disabled ? "cursor-default" : "cursor-grab active:cursor-grabbing"
1759
1768
  ),
1760
1769
  children: [
1761
- !isHorizontal && /* @__PURE__ */ jsx("div", { className: "text-muted-foreground shrink-0", children: /* @__PURE__ */ jsx(DragHandleIcon, {}) }),
1770
+ !isHorizontal && /* @__PURE__ */ jsx("div", { className: "qti-order-item-handle shrink-0", children: /* @__PURE__ */ jsx(DragHandleIcon, {}) }),
1762
1771
  /* @__PURE__ */ jsx(HTMLContent, { html: contentHtml })
1763
1772
  ]
1764
1773
  }
@@ -1768,12 +1777,13 @@ function DragOverlayItem({ contentHtml, isHorizontal }) {
1768
1777
  return /* @__PURE__ */ jsxs(
1769
1778
  "div",
1770
1779
  {
1780
+ "data-dragging": "true",
1771
1781
  className: cn(
1772
- "bg-background border-2 border-macaw rounded-lg shadow-xl cursor-grabbing z-50",
1773
- isHorizontal ? "px-4 py-2 min-w-[100px] flex items-center justify-center" : "p-4 w-full flex items-center gap-3"
1782
+ "qti-order-item cursor-grabbing z-50",
1783
+ isHorizontal ? "min-w-[100px] flex items-center justify-center" : "w-full flex items-center gap-3"
1774
1784
  ),
1775
1785
  children: [
1776
- !isHorizontal && /* @__PURE__ */ jsx("div", { className: "text-macaw shrink-0", children: /* @__PURE__ */ jsx(DragHandleIcon, {}) }),
1786
+ !isHorizontal && /* @__PURE__ */ jsx("div", { className: "qti-order-item-handle shrink-0", children: /* @__PURE__ */ jsx(DragHandleIcon, {}) }),
1777
1787
  /* @__PURE__ */ jsx(HTMLContent, { html: contentHtml })
1778
1788
  ]
1779
1789
  }
@@ -1827,14 +1837,9 @@ function OrderInteraction({
1827
1837
  styles: { active: { opacity: "0.4" } }
1828
1838
  })
1829
1839
  };
1830
- const getContainerStyles = () => {
1831
- if (!hasSubmitted) {
1832
- return "bg-muted/30 border-transparent";
1833
- }
1834
- if (isCorrect) {
1835
- return "bg-owl/10 border-owl";
1836
- }
1837
- return "bg-cardinal/10 border-cardinal";
1840
+ const getContainerCorrectness = () => {
1841
+ if (!hasSubmitted) return void 0;
1842
+ return isCorrect;
1838
1843
  };
1839
1844
  return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
1840
1845
  interaction.promptHtml && /* @__PURE__ */ jsx(HTMLContent, { html: interaction.promptHtml }),
@@ -1849,11 +1854,8 @@ function OrderInteraction({
1849
1854
  /* @__PURE__ */ jsx(SortableContext, { items: items.map((i) => i.id), strategy, disabled: disabled || hasSubmitted, children: /* @__PURE__ */ jsx(
1850
1855
  "div",
1851
1856
  {
1852
- className: cn(
1853
- "rounded-xl p-4 transition-colors border-2",
1854
- isHorizontal ? "flex flex-wrap gap-3" : "flex flex-col gap-2",
1855
- getContainerStyles()
1856
- ),
1857
+ "data-correct": getContainerCorrectness(),
1858
+ className: cn("qti-order-container", isHorizontal ? "flex flex-wrap" : "flex flex-col"),
1857
1859
  children: items.map((item) => /* @__PURE__ */ jsx(
1858
1860
  SortableItem,
1859
1861
  {