var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: !0 });
}, __copyProps = (to, from, except, desc) => {
  if (from && typeof from == "object" || typeof from == "function")
    for (let key of __getOwnPropNames(from))
      !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
var Day_exports = {};
__export(Day_exports, {
  Day: () => Day
});
module.exports = __toCommonJS(Day_exports);
var import_hooks = require("@datepicker-react/hooks"), import_react = require("react"), import_tamagui = require("tamagui"), import_DatePickerProvider = require("./DatePickerProvider"), import_IconButton = require("./IconButton"), import_typography = require("./typography"), import_jsx_runtime = require("react/jsx-runtime");
function Day({ dayLabel, date, ...props }) {
  const dayRef = (0, import_react.useRef)(null), datepickerContext = (0, import_DatePickerProvider.useDatepickerContext)(), {
    isSelected,
    isSelectedStartOrEnd,
    disabledDate,
    onClick,
    isWithinHoverRange
  } = (0, import_hooks.useDay)({
    date,
    dayRef,
    ...datepickerContext
  });
  return dayLabel ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
    DayButton,
    {
      ref: dayRef,
      onPress: onClick,
      cursor: "pointer",
      disabled: disabledDate,
      w: 48,
      h: 48,
      hoverStyle: {
        col: "$onSurfaceVariant"
      },
      col: "$onSurface",
      selected: isSelected,
      selectedStartOrEnd: isSelectedStartOrEnd,
      isWithinHoverRange,
      today: isToday(date),
      ...props,
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DayText, { selectedStartOrEnd: isSelectedStartOrEnd, children: dayLabel })
    }
  ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.View, {});
}
const DayButton = (0, import_tamagui.styled)(import_IconButton.IconButton, {
  name: "DayButton",
  w: 48,
  h: 48,
  bc: "transparent",
  hoverStyle: {
    col: "$onSurfaceVariant"
  },
  variants: {
    selected: {
      true: {
        backgroundColor: "$outlineVariant"
      }
    },
    selectedStartOrEnd: {
      true: {
        backgroundColor: "$outline"
      }
    },
    today: {
      true: {
        borderWidth: "$border.outline",
        borderColor: "$primary",
        borderRadius: 100
      }
    }
  }
}), DayText = (0, import_tamagui.styled)(import_typography.Body, {
  name: "DayText",
  bc: "transparent",
  variants: {
    selectedStartOrEnd: {
      true: {
        color: "$onTertiary"
      }
    }
  }
});
function isToday(date) {
  const today = /* @__PURE__ */ new Date();
  return date.getFullYear() === today.getFullYear() && date.getMonth() === today.getMonth() && date.getDate() === today.getDate();
}
//# sourceMappingURL=Day.js.map
