UNPKG

@undp/design-system-react

Version:

React based design system for UNDP

69 lines (68 loc) 2.14 kB
import { t as e } from "./utils-ca9as9Ye.js"; import { t } from "./dist-CQzJbxrW.js"; import { t as n } from "./calendar-DozgSes3.js"; import { i as r, r as i, t as a } from "./popover-CJlFZacQ.js"; import { r as o, t as s } from "./calendar-card-Dj80RXdf.js"; import * as c from "react"; import { jsx as l, jsxs as u } from "react/jsx-runtime"; //#region src/components/ui/date-picker.tsx var d = t("w-full h-auto bg-background rounded-base text-content-primary text-base transition-colors focus-visible:outline-hidden focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-disabled placeholder:text-content-placeholder", { variants: { variant: { light: "border border-stroke", normal: "border-2 border-foreground" }, rounded: { base: "rounded", sm: "rounded-sm", md: "rounded-md", lg: "rounded-lg", xl: "rounded-xl", "2xl": "rounded-2xl", full: "rounded-full" }, inputSize: { sm: "px-2.5 py-1", base: "p-2.5" } }, defaultVariants: { inputSize: "base", variant: "normal", rounded: "base" } }); function f({ selected: t, onSelect: f, disablePopover: p, classNames: m, variant: h, inputSize: g, placeHolder: _ = "Pick a date", ...v }) { let [y, b] = c.useState(), [x, S] = c.useState(!1); return /* @__PURE__ */ u(a, { open: x, onOpenChange: S, children: [/* @__PURE__ */ u(r, { className: e(d({ inputSize: g, variant: h }), m?.popOverTrigger), children: [/* @__PURE__ */ l(n, { className: e("size-4 text-content-placeholder", m?.popOverTriggerIcon) }), y ? /* @__PURE__ */ l("p", { className: "mt-1 p-0 font-body text-content-primary", children: o(y, "MMM d, yyyy") }) : /* @__PURE__ */ l("p", { className: "mt-1 p-0 font-body text-content-placeholder", children: _ })] }), /* @__PURE__ */ l(i, { className: e("w-auto p-0", m?.popOverContent), align: "start", children: /* @__PURE__ */ l(s, { mode: "single", selected: t || y, onSelect: (e, t, n, r) => { b(e), f?.(e, t, n, r), S(!1); }, ...v }) })] }); } //#endregion export { f as DatePicker }; //# sourceMappingURL=DatePicker.js.map