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.cjs CHANGED
@@ -847,7 +847,7 @@ function VoiceMicButton({ fieldId, onTranscriptReady }) {
847
847
  setActiveFieldId(fieldId);
848
848
  setStatus("recording");
849
849
  try {
850
- await voice.startRecording();
850
+ await voice.startRecording(fieldId);
851
851
  } catch {
852
852
  setStatus("idle");
853
853
  setActiveFieldId(null);
@@ -1229,6 +1229,19 @@ var RichTextWidget = ({ fieldId }) => {
1229
1229
  const el = editor.view.dom;
1230
1230
  el.style.minHeight = `${minHeight}px`;
1231
1231
  }, [editor, minHeight]);
1232
+ React15.useEffect(() => {
1233
+ if (!editor || editor.isDestroyed) return;
1234
+ const el = editor.view.dom;
1235
+ const handler = (e) => {
1236
+ const { text } = e.detail;
1237
+ if (!text) return;
1238
+ const currentText = editor.getText();
1239
+ const prefix = currentText.length > 0 && !/\s$/.test(currentText) ? " " : "";
1240
+ editor.chain().focus().insertContent(prefix + text).run();
1241
+ };
1242
+ el.addEventListener("insertTranscript", handler);
1243
+ return () => el.removeEventListener("insertTranscript", handler);
1244
+ }, [editor]);
1232
1245
  React15.useEffect(() => {
1233
1246
  if (!editor || editor.isDestroyed) return;
1234
1247
  const fromForm = stringValue;
@@ -1715,29 +1728,66 @@ var RepeatableWidget = ({
1715
1728
  showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
1716
1729
  ] });
1717
1730
  };
1731
+ function CalendarDropdown(props) {
1732
+ const { options, value, onChange } = props;
1733
+ const handleValueChange = (newValue) => {
1734
+ if (!onChange) return;
1735
+ const syntheticEvent = {
1736
+ target: { value: newValue }
1737
+ };
1738
+ onChange(syntheticEvent);
1739
+ };
1740
+ return /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: value?.toString(), onValueChange: handleValueChange, children: [
1741
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-7 px-2 text-sm", "aria-label": props["aria-label"], children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
1742
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
1743
+ SelectItem,
1744
+ {
1745
+ value: option.value.toString(),
1746
+ disabled: option.disabled,
1747
+ children: option.label
1748
+ },
1749
+ option.value.toString()
1750
+ )) })
1751
+ ] });
1752
+ }
1718
1753
  function Calendar({
1719
1754
  className,
1720
1755
  classNames,
1721
1756
  showOutsideDays = true,
1722
1757
  ...props
1723
1758
  }) {
1759
+ const captionLayout = props.captionLayout ?? "dropdown";
1760
+ const isDropdownCaption = captionLayout === "dropdown" || captionLayout === "dropdown-months" || captionLayout === "dropdown-years";
1761
+ const startMonth = props.startMonth ?? (isDropdownCaption ? new Date(1900, 0) : void 0);
1762
+ const endMonth = props.endMonth ?? (isDropdownCaption ? new Date(2100, 11) : void 0);
1724
1763
  return /* @__PURE__ */ jsxRuntime.jsx(
1725
1764
  reactDayPicker.DayPicker,
1726
1765
  {
1727
1766
  showOutsideDays,
1767
+ captionLayout,
1768
+ hideNavigation: props.hideNavigation ?? isDropdownCaption,
1769
+ navLayout: props.navLayout ?? (isDropdownCaption ? "around" : void 0),
1770
+ startMonth,
1771
+ endMonth,
1728
1772
  className: cn("p-3 relative", className),
1729
1773
  classNames: {
1730
1774
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
1731
1775
  month: "space-y-4",
1732
1776
  caption: "flex justify-center pt-1 relative items-center",
1733
- caption_label: "text-sm font-medium",
1777
+ caption_label: cn(
1778
+ "text-sm font-medium",
1779
+ isDropdownCaption && "sr-only"
1780
+ ),
1781
+ dropdowns: "flex items-center gap-2",
1782
+ months_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
1783
+ years_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
1734
1784
  nav: "space-x-1 flex items-center",
1735
1785
  nav_button: cn(
1736
1786
  buttonVariants({ variant: "outline" }),
1737
1787
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
1738
1788
  ),
1739
- nav_button_previous: "absolute left-1",
1740
- nav_button_next: "absolute right-1",
1789
+ nav_button_previous: isDropdownCaption ? "" : "absolute left-1",
1790
+ nav_button_next: isDropdownCaption ? "" : "absolute right-1",
1741
1791
  table: "w-full border-collapse space-y-1",
1742
1792
  head_row: "flex",
1743
1793
  head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
@@ -1758,12 +1808,12 @@ function Calendar({
1758
1808
  button_previous: cn(
1759
1809
  buttonVariants({ variant: "outline" }),
1760
1810
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
1761
- "absolute left-1 top-3"
1811
+ isDropdownCaption ? "" : "absolute left-1 top-3"
1762
1812
  ),
1763
1813
  button_next: cn(
1764
1814
  buttonVariants({ variant: "outline" }),
1765
1815
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
1766
- "absolute right-1 top-3"
1816
+ isDropdownCaption ? "" : "absolute right-1 top-3"
1767
1817
  ),
1768
1818
  month_grid: "w-full border-collapse space-y-1",
1769
1819
  weekdays: "flex",
@@ -1783,9 +1833,11 @@ function Calendar({
1783
1833
  ...classNames
1784
1834
  },
1785
1835
  components: {
1786
- IconLeft: ({ ...props2 }) => /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }),
1787
- IconRight: ({ ...props2 }) => /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" }),
1788
- // @ts-ignore
1836
+ IconLeft: () => /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }),
1837
+ IconRight: () => /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" }),
1838
+ // @ts-expect-error react-day-picker v9 component typing differences
1839
+ Dropdown: CalendarDropdown,
1840
+ // @ts-expect-error react-day-picker v9 component typing differences
1789
1841
  Chevron: ({ orientation }) => {
1790
1842
  const Icon2 = orientation === "left" ? lucideReact.ChevronLeft : lucideReact.ChevronRight;
1791
1843
  return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-4 w-4" });