import { t as e } from "../../../button-BNOmhdpM.js";
import { n as t, o as n, t as r } from "../../../popover-Ck3ILBUA.js";
import { r as i, t as a } from "../../../calendar-DizaWURn.js";
import { t as o } from "../../../input-CSc-AfAa.js";
import { Label as s } from "../atoms/label.js";
import { useState as c } from "react";
import { jsx as l, jsxs as u } from "react/jsx-runtime";
import { ChevronDownIcon as d } from "lucide-react";
//#region lib/components/ui/molecules/date-time-picker.tsx
function f({ value: f, onChange: p, className: m, ...h }) {
	let [g, _] = c(!1), v = f ? i(f, "HH:mm:ss") : "";
	return /* @__PURE__ */ l("div", {
		className: m,
		children: /* @__PURE__ */ u("div", {
			className: "flex gap-4",
			children: [/* @__PURE__ */ u("div", {
				className: "flex flex-col gap-3",
				children: [/* @__PURE__ */ u(s, {
					className: "px-1",
					htmlFor: "date-picker",
					children: ["Date:", " "]
				}), /* @__PURE__ */ u(r, {
					onOpenChange: _,
					open: g,
					children: [/* @__PURE__ */ u(n, {
						render: /* @__PURE__ */ l(e, {
							className: "w-32 justify-between font-normal",
							id: "date-picker",
							size: "lg",
							variant: "outline"
						}),
						children: [/* @__PURE__ */ l("span", { children: f ? f.toLocaleDateString() : "Select date" }), /* @__PURE__ */ l(d, {})]
					}), /* @__PURE__ */ l(t, {
						align: "start",
						className: "w-auto overflow-hidden p-0",
						children: /* @__PURE__ */ l(a, {
							captionLayout: "dropdown",
							mode: "single",
							onSelect: (e) => {
								p?.(e), _(!1);
							},
							selected: f,
							...h
						})
					})]
				})]
			}), /* @__PURE__ */ u("div", {
				className: "flex flex-col gap-3",
				children: [/* @__PURE__ */ u(s, {
					className: "px-1",
					htmlFor: "time-picker",
					children: ["Time:", " "]
				}), /* @__PURE__ */ l(o, {
					className: "appearance-none bg-background [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none",
					id: "time-picker",
					onChange: (e) => {
						let t = e.target.value;
						if (!(t && f)) return;
						let [n, r, i] = t.split(":").map(Number), a = new Date(f);
						a.setHours(n, r, i || 0), p?.(a);
					},
					step: "1",
					type: "time",
					value: v
				})]
			})]
		})
	});
}
f.displayName = "DateTimePicker";
//#endregion
export { f as DateTimePicker };
