@mantine/dates
Version:
Calendars, date and time pickers based on Mantine components
54 lines (53 loc) • 1.94 kB
JavaScript
"use client";
import { useDatesContext } from "../DatesProvider/use-dates-context.mjs";
import { getWeekdayNames } from "./get-weekdays-names/get-weekdays-names.mjs";
import WeekdaysRow_module_default from "./WeekdaysRow.module.mjs";
import { jsx, jsxs } from "react/jsx-runtime";
import { Box, createVarsResolver, factory, getFontSize, getSpacing, useProps, useStyles } from "@mantine/core";
//#region packages/@mantine/dates/src/components/WeekdaysRow/WeekdaysRow.tsx
const varsResolver = createVarsResolver((_, { size }) => ({ weekdaysRow: {
"--wr-fz": getFontSize(size),
"--wr-spacing": getSpacing(size)
} }));
const WeekdaysRow = factory((_props) => {
const props = useProps("WeekdaysRow", null, _props);
const { classNames, className, style, styles, unstyled, vars, locale, firstDayOfWeek, weekdayFormat, cellComponent: CellComponent = "th", __staticSelector, withWeekNumbers, attributes, ...others } = props;
const getStyles = useStyles({
name: __staticSelector || "WeekdaysRow",
classes: WeekdaysRow_module_default,
props,
className,
style,
classNames,
styles,
unstyled,
attributes,
vars,
varsResolver,
rootSelector: "weekdaysRow"
});
const ctx = useDatesContext();
const weekdays = getWeekdayNames({
locale: ctx.getLocale(locale),
format: weekdayFormat,
firstDayOfWeek: ctx.getFirstDayOfWeek(firstDayOfWeek)
}).map((weekday, index) => /* @__PURE__ */ jsx(CellComponent, {
...getStyles("weekday"),
children: weekday
}, index));
return /* @__PURE__ */ jsxs(Box, {
component: "tr",
...getStyles("weekdaysRow"),
...others,
children: [withWeekNumbers && /* @__PURE__ */ jsx(CellComponent, {
...getStyles("weekday"),
children: "#"
}), weekdays]
});
});
WeekdaysRow.classes = WeekdaysRow_module_default;
WeekdaysRow.varsResolver = varsResolver;
WeekdaysRow.displayName = "@mantine/dates/WeekdaysRow";
//#endregion
export { WeekdaysRow };
//# sourceMappingURL=WeekdaysRow.mjs.map