import {
  DatePicker
} from "./chunk-WH5ODUZA.js";
import {
  Box
} from "./chunk-4Y5BEXVN.js";
import {
  Flex
} from "./chunk-25HMMI7R.js";
import {
  Button
} from "./chunk-AFPH32MF.js";
import {
  CalendarIcon
} from "./chunk-V5XKNSCK.js";
import {
  __objRest,
  __spreadProps,
  __spreadValues
} from "./chunk-2NMEKWO5.js";

// src/molecules/date-picker/date-picker-button.tsx
import { useMemo } from "react";
import { format } from "date-fns";
import { clsx } from "clsx";
import { jsx, jsxs } from "react/jsx-runtime";
function DatePickerButton(props) {
  const _a = props, { size, placeholder, format: formatProps, disabled } = _a, rest = __objRest(_a, ["size", "placeholder", "format", "disabled"]);
  const buttonProps = useMemo(() => {
    const variant = "outline";
    const color = "gray";
    return { size, color, variant, disabled };
  }, [disabled, size]);
  const selectFormat = useMemo(() => {
    if (formatProps) return formatProps;
    return (date) => {
      return date ? format(date, "yyyy\uB144 MM\uC6D4 dd\uC77C") : placeholder;
    };
  }, [formatProps, placeholder]);
  const className = useMemo(() => {
    return clsx(
      "date-picker-button",
      (disabled || props.readOnly) && "disabled"
    );
  }, [disabled, props.readOnly]);
  return /* @__PURE__ */ jsx(Box, { p: "0", width: "100%", children: /* @__PURE__ */ jsx(
    DatePicker,
    __spreadProps(__spreadValues({
      customInput: /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({ className, type: "button" }, buttonProps), { children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: "3", justify: "between", width: "100%", children: [
        rest.selected ? selectFormat(rest.selected) : placeholder,
        /* @__PURE__ */ jsx(CalendarIcon, {})
      ] }) })),
      wrapperClassName: "full-width"
    }, rest), {
      disabled
    })
  ) });
}

export {
  DatePickerButton
};
//# sourceMappingURL=chunk-KD5LEAJW.js.map