fui-fancyui
Version:
FancyUI Libary
47 lines (46 loc) • 1.31 kB
JavaScript
"use client";
import { jsx as s } from "react/jsx-runtime";
import { useState as l, useMemo as b, useEffect as d } from "react";
import z from "../Typography/Typography.js";
import { sizeSettings as T } from "./sizeSettings.js";
import { DateOutputButton as A } from "./DateOutput.style.js";
function j(f) {
const {
date: a,
isActive: t,
themeType: p = "primary",
layer: m,
onClick: i,
textCustom: e,
sizeC: o = "md",
borderRadius: u,
...h
} = f, [g, n] = l(!1), [r, v] = l(void 0), c = b(() => {
if (!r) return "";
const S = navigator.language, D = { day: "numeric", month: "short" }, $ = r.toLocaleDateString(S, D);
return `${(e == null ? void 0 : e.selected) ?? ""} ${$}`;
}, [r, e]), y = () => {
n(!0), i && i();
};
return d(() => {
v(a);
}, [a]), d(() => {
n(t ?? !1);
}, [t]), /* @__PURE__ */ s(
A,
{
$sizeC: o,
$borderRadius: u,
onClick: y,
$themeType: p,
$layer: m,
$isActive: g && t,
"aria-label": c || (e == null ? void 0 : e.notSelected),
...h,
children: /* @__PURE__ */ s(z, { variant: T[o].fontSize, fontWeight: t ? "bold" : void 0, lineHeight: 1, children: c || (e == null ? void 0 : e.notSelected) || "Select a date" })
}
);
}
export {
j as default
};