formanitor 0.0.29 → 0.0.30

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.mjs CHANGED
@@ -1680,29 +1680,66 @@ var RepeatableWidget = ({
1680
1680
  showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
1681
1681
  ] });
1682
1682
  };
1683
+ function CalendarDropdown(props) {
1684
+ const { options, value, onChange } = props;
1685
+ const handleValueChange = (newValue) => {
1686
+ if (!onChange) return;
1687
+ const syntheticEvent = {
1688
+ target: { value: newValue }
1689
+ };
1690
+ onChange(syntheticEvent);
1691
+ };
1692
+ return /* @__PURE__ */ jsxs(Select, { value: value?.toString(), onValueChange: handleValueChange, children: [
1693
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "h-7 px-2 text-sm", "aria-label": props["aria-label"], children: /* @__PURE__ */ jsx(SelectValue, {}) }),
1694
+ /* @__PURE__ */ jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsx(
1695
+ SelectItem,
1696
+ {
1697
+ value: option.value.toString(),
1698
+ disabled: option.disabled,
1699
+ children: option.label
1700
+ },
1701
+ option.value.toString()
1702
+ )) })
1703
+ ] });
1704
+ }
1683
1705
  function Calendar({
1684
1706
  className,
1685
1707
  classNames,
1686
1708
  showOutsideDays = true,
1687
1709
  ...props
1688
1710
  }) {
1711
+ const captionLayout = props.captionLayout ?? "dropdown";
1712
+ const isDropdownCaption = captionLayout === "dropdown" || captionLayout === "dropdown-months" || captionLayout === "dropdown-years";
1713
+ const startMonth = props.startMonth ?? (isDropdownCaption ? new Date(1900, 0) : void 0);
1714
+ const endMonth = props.endMonth ?? (isDropdownCaption ? new Date(2100, 11) : void 0);
1689
1715
  return /* @__PURE__ */ jsx(
1690
1716
  DayPicker,
1691
1717
  {
1692
1718
  showOutsideDays,
1719
+ captionLayout,
1720
+ hideNavigation: props.hideNavigation ?? isDropdownCaption,
1721
+ navLayout: props.navLayout ?? (isDropdownCaption ? "around" : void 0),
1722
+ startMonth,
1723
+ endMonth,
1693
1724
  className: cn("p-3 relative", className),
1694
1725
  classNames: {
1695
1726
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
1696
1727
  month: "space-y-4",
1697
1728
  caption: "flex justify-center pt-1 relative items-center",
1698
- caption_label: "text-sm font-medium",
1729
+ caption_label: cn(
1730
+ "text-sm font-medium",
1731
+ isDropdownCaption && "sr-only"
1732
+ ),
1733
+ dropdowns: "flex items-center gap-2",
1734
+ months_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
1735
+ years_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
1699
1736
  nav: "space-x-1 flex items-center",
1700
1737
  nav_button: cn(
1701
1738
  buttonVariants({ variant: "outline" }),
1702
1739
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
1703
1740
  ),
1704
- nav_button_previous: "absolute left-1",
1705
- nav_button_next: "absolute right-1",
1741
+ nav_button_previous: isDropdownCaption ? "" : "absolute left-1",
1742
+ nav_button_next: isDropdownCaption ? "" : "absolute right-1",
1706
1743
  table: "w-full border-collapse space-y-1",
1707
1744
  head_row: "flex",
1708
1745
  head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
@@ -1723,12 +1760,12 @@ function Calendar({
1723
1760
  button_previous: cn(
1724
1761
  buttonVariants({ variant: "outline" }),
1725
1762
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
1726
- "absolute left-1 top-3"
1763
+ isDropdownCaption ? "" : "absolute left-1 top-3"
1727
1764
  ),
1728
1765
  button_next: cn(
1729
1766
  buttonVariants({ variant: "outline" }),
1730
1767
  "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
1731
- "absolute right-1 top-3"
1768
+ isDropdownCaption ? "" : "absolute right-1 top-3"
1732
1769
  ),
1733
1770
  month_grid: "w-full border-collapse space-y-1",
1734
1771
  weekdays: "flex",
@@ -1748,9 +1785,11 @@ function Calendar({
1748
1785
  ...classNames
1749
1786
  },
1750
1787
  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
1788
+ IconLeft: () => /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" }),
1789
+ IconRight: () => /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }),
1790
+ // @ts-expect-error react-day-picker v9 component typing differences
1791
+ Dropdown: CalendarDropdown,
1792
+ // @ts-expect-error react-day-picker v9 component typing differences
1754
1793
  Chevron: ({ orientation }) => {
1755
1794
  const Icon2 = orientation === "left" ? ChevronLeft : ChevronRight;
1756
1795
  return /* @__PURE__ */ jsx(Icon2, { className: "h-4 w-4" });