import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useMonth } from "@datepicker-react/hooks";
import { SizableText, Stack, XStack } from "tamagui";
import { useMemo } from "react";
import { Day } from "./Day.native.js";
function Month(param) {
  var {
      year,
      ...props
    } = param,
    {
      days,
      weekdayLabels
    } = useMonth({
      ...props,
      year,
      dayLabelFormat: function (date) {
        return new Intl.DateTimeFormat(void 0, {
          day: "numeric"
        }).format(date);
      },
      weekdayLabelFormat: function (date) {
        return new Intl.DateTimeFormat(void 0, {
          weekday: "narrow"
        }).format(date);
      }
    }),
    weeks = useMemo(function () {
      return splitIntoWeeks(days);
    }, [days]);
  return /* @__PURE__ */_jsxs(Stack, {
    maxWidth: "100%",
    flexDirection: "column",
    gap: 12,
    children: [/* WEEK DAY */
    /* @__PURE__ */_jsx(XStack, {
      pb: 16,
      children: weekdayLabels.map(function (dayLabel, index) {
        return /* @__PURE__ */_jsx(SizableText, {
          w: "14%",
          ta: "center",
          col: "$onSurfaceVariant",
          children: dayLabel
        }, `day-label-${index}`);
      })
    }), weeks.map(function (week, index) {
      return /* @__PURE__ */_jsx(XStack, {
        children: week.map(function (day, index2) {
          return /* @__PURE__ */_jsx(Stack, {
            w: "14%",
            ai: "center",
            children: typeof day == "object" && /* @__PURE__ */_jsx(Day, {
              dayLabel: day.dayLabel,
              date: day.date
            }, day.date.toString())
          }, `month-day-${index2}`);
        })
      }, `week-${index}`);
    })]
  });
}
function splitIntoWeeks(array) {
  for (var result = [], weekLength = 7, i = 0; i < array.length; i += weekLength) {
    var week = array.slice(i, i + weekLength);
    result.push(week);
  }
  return result;
}
export { Month };
//# sourceMappingURL=Month.native.js.map
