"use client";
'use strict';

const jsxRuntime = require('react/jsx-runtime');
const dateFns = require('date-fns');
const LucideIcons = require('lucide-react');
const utils = require('../lib/utils.cjs');
const button = require('./button.cjs');
const calendar = require('./calendar.cjs');
const popover = require('./popover.cjs');
const React = require('react');

const DatePicker = React.forwardRef(function DatePickerCmp({ date, setDate }, ref) {
  return /* @__PURE__ */ jsxRuntime.jsxs(popover.Popover, { children: [
    /* @__PURE__ */ jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
      button.Button,
      {
        variant: "outline",
        className: utils.cn(
          "w-full justify-start text-left font-normal",
          !date && "text-muted-foreground"
        ),
        children: [
          /* @__PURE__ */ jsxRuntime.jsx(LucideIcons.Calendar, { className: "mr-2 h-4 w-4" }),
          date ? dateFns.format(date, "PPP") : /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Pick a date" })
        ]
      }
    ) }),
    /* @__PURE__ */ jsxRuntime.jsx(popover.PopoverContent, { className: "w-auto p-0", ref, children: /* @__PURE__ */ jsxRuntime.jsx(
      calendar.Calendar,
      {
        mode: "single",
        selected: date,
        onSelect: setDate,
        initialFocus: true
      }
    ) })
  ] });
});

exports.DatePicker = DatePicker;
