@rnwonder/solid-date-picker
Version:
A responsive, highly-customizable datepicker component for SolidJS.
52 lines (51 loc) • 2.8 kB
JavaScript
import { insert as c, createComponent as o, mergeProps as D, effect as n, className as h, template as u } from "solid-js/web";
import { createSignal as g, For as l } from "solid-js";
import { applyDateRangeProps as p } from "../../../node_modules/.pnpm/@rnwonder_simple-datejs@1.1.1/node_modules/@rnwonder/simple-datejs/dist/datePicker.js";
import { DatePickerDay as C } from "../DatePickerDay/index.js";
import { DatePickerWeek as v } from "../DatePickerWeek/index.js";
import { createDaysArray as k } from "../../hooks/createDaysArray.js";
import { convertFormattedNumberBackToNumber as b } from "../../utils/general.js";
import { cn as y } from "../../utils/class.js";
var f = u("<div data-type=calendar-days-area data-scope=date-picker>");
const A = (e) => {
const [s, d] = g([]);
return k({ month: e.month, year: e.year, weekStartDay: e.weekStartDay, locale: e.locale || "en-US", setDayRowsArray: d, dayRowsArray: s }), t = f(), c(t, o(l, { get each() {
return s();
}, children: (m, i) => o(v, { get daysRowClass() {
var a;
return y({ "rn-hidden": ((a = e.showSelectorTwo) == null ? void 0 : a.call(e)) && i() > 0 }, e.daysRowClass);
}, get children() {
return o(l, { each: m, children: (a) => {
const r = b(e.locale || "en-US", a);
return o(C, D(() => ({ ...e, calendarWeekDaysNameClass: void 0 }), () => p({ year: e.year, day: r, month: e.month, startDay: e.startDay(), endDay: e.endDay(), customDaysClassName: e.customDaysClassName, multipleObject: e.multipleObject(), hideOutSideDays: e.hideOutSideDays, hoverRangeValue: e.hoverRangeValue, enabledDays: e.enabledDays, minDate: e.minDate, maxDate: e.maxDate, disabledDays: e.disabledDays }), { get year() {
return e.year;
}, get month() {
return e.month;
}, get day() {
return r.value;
}, onClick: () => e.handleDayClick(r, e.month, e.year, e.nextMonth || !1), onHover: () => e.onHoverDay(r, e.month, e.year, e.nextMonth || !1), onHoverEnd: () => e.onHoverDayEnd(r, e.month, e.year, e.nextMonth || !1), get primaryColor() {
return e.primaryColor;
}, get primaryTextColor() {
return e.primaryTextColor;
}, get secondaryColor() {
return e.secondaryColor;
}, get secondaryTextColor() {
return e.secondaryTextColor;
}, get disabledDays() {
return e.disabledDays;
}, get shouldHighlightWeekends() {
return e.shouldHighlightWeekends;
}, get onDisabledDayError() {
return e.onDisabledDayError;
}, get hoverRangeValue() {
return e.hoverRangeValue;
}, get children() {
return a.value;
} }));
} });
} }) })), n(() => h(t, y("date-picker-calendar-days-area", e.datePickerCalendarDaysArea))), t;
var t;
};
export {
A as CalendarDays
};