formanitor 0.0.29 → 0.0.31

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/index.d.cts CHANGED
@@ -462,7 +462,7 @@ interface StoreConfig {
462
462
  * - `stopRecording` — stop capturing, transcribe, and return the transcript
463
463
  */
464
464
  voice?: {
465
- startRecording: () => Promise<void>;
465
+ startRecording: (fieldId?: string) => Promise<void>;
466
466
  stopRecording: () => Promise<string>;
467
467
  };
468
468
  }
package/dist/index.d.ts CHANGED
@@ -462,7 +462,7 @@ interface StoreConfig {
462
462
  * - `stopRecording` — stop capturing, transcribe, and return the transcript
463
463
  */
464
464
  voice?: {
465
- startRecording: () => Promise<void>;
465
+ startRecording: (fieldId?: string) => Promise<void>;
466
466
  stopRecording: () => Promise<string>;
467
467
  };
468
468
  }
package/dist/index.mjs CHANGED
@@ -812,7 +812,7 @@ function VoiceMicButton({ fieldId, onTranscriptReady }) {
812
812
  setActiveFieldId(fieldId);
813
813
  setStatus("recording");
814
814
  try {
815
- await voice.startRecording();
815
+ await voice.startRecording(fieldId);
816
816
  } catch {
817
817
  setStatus("idle");
818
818
  setActiveFieldId(null);
@@ -1194,6 +1194,19 @@ var RichTextWidget = ({ fieldId }) => {
1194
1194
  const el = editor.view.dom;
1195
1195
  el.style.minHeight = `${minHeight}px`;
1196
1196
  }, [editor, minHeight]);
1197
+ useEffect(() => {
1198
+ if (!editor || editor.isDestroyed) return;
1199
+ const el = editor.view.dom;
1200
+ const handler = (e) => {
1201
+ const { text } = e.detail;
1202
+ if (!text) return;
1203
+ const currentText = editor.getText();
1204
+ const prefix = currentText.length > 0 && !/\s$/.test(currentText) ? " " : "";
1205
+ editor.chain().focus().insertContent(prefix + text).run();
1206
+ };
1207
+ el.addEventListener("insertTranscript", handler);
1208
+ return () => el.removeEventListener("insertTranscript", handler);
1209
+ }, [editor]);
1197
1210
  useEffect(() => {
1198
1211
  if (!editor || editor.isDestroyed) return;
1199
1212
  const fromForm = stringValue;
@@ -1680,29 +1693,66 @@ var RepeatableWidget = ({
1680
1693
  showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
1681
1694
  ] });
1682
1695
  };
1696
+ function CalendarDropdown(props) {
1697
+ const { options, value, onChange } = props;
1698
+ const handleValueChange = (newValue) => {
1699
+ if (!onChange) return;
1700
+ const syntheticEvent = {
1701
+ target: { value: newValue }
1702
+ };
1703
+ onChange(syntheticEvent);
1704
+ };
1705
+ return /* @__PURE__ */ jsxs(Select, { value: value?.toString(), onValueChange: handleValueChange, children: [
1706
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "h-7 px-2 text-sm", "aria-label": props["aria-label"], children: /* @__PURE__ */ jsx(SelectValue, {}) }),
1707
+ /* @__PURE__ */ jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsx(
1708
+ SelectItem,
1709
+ {
1710
+ value: option.value.toString(),
1711
+ disabled: option.disabled,
1712
+ children: option.label
1713
+ },
1714
+ option.value.toString()
1715
+ )) })
1716
+ ] });
1717
+ }
1683
1718
  function Calendar({
1684
1719
  className,
1685
1720
  classNames,
1686
1721
  showOutsideDays = true,
1687
1722
  ...props
1688
1723
  }) {
1724
+ const captionLayout = props.captionLayout ?? "dropdown";
1725
+ const isDropdownCaption = captionLayout === "dropdown" || captionLayout === "dropdown-months" || captionLayout === "dropdown-years";
1726
+ const startMonth = props.startMonth ?? (isDropdownCaption ? new Date(1900, 0) : void 0);
1727
+ const endMonth = props.endMonth ?? (isDropdownCaption ? new Date(2100, 11) : void 0);
1689
1728
  return /* @__PURE__ */ jsx(
1690
1729
  DayPicker,
1691
1730
  {
1692
1731
  showOutsideDays,
1732
+ captionLayout,
1733
+ hideNavigation: props.hideNavigation ?? isDropdownCaption,
1734
+ navLayout: props.navLayout ?? (isDropdownCaption ? "around" : void 0),
1735
+ startMonth,
1736
+ endMonth,
1693
1737
  className: cn("p-3 relative", className),
1694
1738
  classNames: {
1695
1739
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
1696
1740
  month: "space-y-4",
1697
1741
  caption: "flex justify-center pt-1 relative items-center",
1698
- caption_label: "text-sm font-medium",
1742
+ caption_label: cn(
1743
+ "text-sm font-medium",
1744
+ isDropdownCaption && "sr-only"
1745
+ ),
1746
+ dropdowns: "flex items-center gap-2",
1747
+ months_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
1748
+ years_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
1699
1749
  nav: "space-x-1 flex items-center",
1700
1750
  nav_button: cn(
1701
1751
  buttonVariants({ variant: "outline" }),
1702
1752
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
1703
1753
  ),
1704
- nav_button_previous: "absolute left-1",
1705
- nav_button_next: "absolute right-1",
1754
+ nav_button_previous: isDropdownCaption ? "" : "absolute left-1",
1755
+ nav_button_next: isDropdownCaption ? "" : "absolute right-1",
1706
1756
  table: "w-full border-collapse space-y-1",
1707
1757
  head_row: "flex",
1708
1758
  head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
@@ -1723,12 +1773,12 @@ function Calendar({
1723
1773
  button_previous: cn(
1724
1774
  buttonVariants({ variant: "outline" }),
1725
1775
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
1726
- "absolute left-1 top-3"
1776
+ isDropdownCaption ? "" : "absolute left-1 top-3"
1727
1777
  ),
1728
1778
  button_next: cn(
1729
1779
  buttonVariants({ variant: "outline" }),
1730
1780
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
1731
- "absolute right-1 top-3"
1781
+ isDropdownCaption ? "" : "absolute right-1 top-3"
1732
1782
  ),
1733
1783
  month_grid: "w-full border-collapse space-y-1",
1734
1784
  weekdays: "flex",
@@ -1748,9 +1798,11 @@ function Calendar({
1748
1798
  ...classNames
1749
1799
  },
1750
1800
  components: {
1751
- IconLeft: ({ ...props2 }) => /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
1752
- IconRight: ({ ...props2 }) => /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }),
1753
- // @ts-ignore
1801
+ IconLeft: () => /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
1802
+ IconRight: () => /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }),
1803
+ // @ts-expect-error react-day-picker v9 component typing differences
1804
+ Dropdown: CalendarDropdown,
1805
+ // @ts-expect-error react-day-picker v9 component typing differences
1754
1806
  Chevron: ({ orientation }) => {
1755
1807
  const Icon2 = orientation === "left" ? ChevronLeft : ChevronRight;
1756
1808
  return /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4" });