@yamada-ui/calendar
Version:
Yamada UI calendar component
98 lines (96 loc) • 3.47 kB
JavaScript
"use client"
import {
useMonthList
} from "./chunk-NLP6FHMB.mjs";
import {
CalendarHeader
} from "./chunk-D7INJNSZ.mjs";
import {
useCalendarContext
} from "./chunk-UMK6LUR5.mjs";
// src/month-list.tsx
import { Button } from "@yamada-ui/button";
import { ui } from "@yamada-ui/core";
import { cx, filterUndefined } from "@yamada-ui/utils";
import { jsx, jsxs } from "react/jsx-runtime";
var MonthList = ({
className,
controlProps,
headerProps,
labelProps,
monthGridProps,
monthProps,
nextProps,
prevProps,
...rest
}) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
const { styles, year } = useCalendarContext();
const { label, rangeMonths, getButtonProps, getGridProps } = useMonthList();
const { component: customMonth, ...computedMonthProps } = monthProps != null ? monthProps : {};
const w = (_a = rest.w) != null ? _a : rest.width;
const minW = (_b = rest.minW) != null ? _b : rest.minWidth;
const maxW = (_c = rest.maxW) != null ? _c : rest.maxWidth;
const h = (_d = rest.h) != null ? _d : rest.height;
const minH = (_e = rest.minH) != null ? _e : rest.minHeight;
const maxH = (_f = rest.maxH) != null ? _f : rest.maxHeight;
return /* @__PURE__ */ jsxs(ui.div, { __css: { ...styles.content }, ...filterUndefined(rest), children: [
/* @__PURE__ */ jsx(
CalendarHeader,
{
...{
...headerProps,
label,
controlProps,
labelProps,
nextProps,
prevProps
}
}
),
/* @__PURE__ */ jsx(
ui.div,
{
className: cx("ui-calendar__month-list", className),
__css: {
display: "grid",
h: (_i = (_g = styles.content) == null ? void 0 : _g.h) != null ? _i : (_h = styles.content) == null ? void 0 : _h.height,
maxH: (_l = (_j = styles.content) == null ? void 0 : _j.maxH) != null ? _l : (_k = styles.content) == null ? void 0 : _k.maxHeight,
maxW: (_o = (_m = styles.content) == null ? void 0 : _m.maxW) != null ? _o : (_n = styles.content) == null ? void 0 : _n.maxWidth,
minH: (_r = (_p = styles.content) == null ? void 0 : _p.minH) != null ? _r : (_q = styles.content) == null ? void 0 : _q.minHeight,
minW: (_u = (_s = styles.content) == null ? void 0 : _s.minW) != null ? _u : (_t = styles.content) == null ? void 0 : _t.minWidth,
w: (_x = (_v = styles.content) == null ? void 0 : _v.w) != null ? _x : (_w = styles.content) == null ? void 0 : _w.width,
...styles.month
},
...getGridProps({
...filterUndefined({ h, maxH, maxW, minH, minW, w }),
...monthGridProps
}),
children: rangeMonths.map((month, index) => /* @__PURE__ */ jsx(
Button,
{
className: "ui-calendar__month-list__button",
variant: "ghost",
__css: {
fontSize: void 0,
fontWeight: "normal",
h: "auto",
minW: "auto",
p: 0,
...styles.button
},
...getButtonProps({ ...computedMonthProps, value: index }),
children: customMonth ? customMonth({ index, month, year }) : month
},
index
))
}
)
] });
};
MonthList.displayName = "MonthList";
MonthList.__ui__ = "MonthList";
export {
MonthList
};
//# sourceMappingURL=chunk-4UGZ5WA3.mjs.map