UNPKG

@rnwonder/solid-date-picker

Version:

A responsive, highly-customizable datepicker component for SolidJS.

51 lines (50 loc) 2.79 kB
import { insert as m, createComponent as o, mergeProps as i, effect as c, className as D, template as u } from "solid-js/web"; import { For as s } from "solid-js"; import { applyDateRangeProps as h } from "../../../node_modules/.pnpm/@rnwonder_simple-datejs@1.1.1/node_modules/@rnwonder/simple-datejs/dist/datePicker.js"; import { DatePickerDay as n } from "../DatePickerDay/index.js"; import { DatePickerWeek as g } from "../DatePickerWeek/index.js"; import { createDaysArray as p } from "../../hooks/createDaysArray.js"; import { convertFormattedNumberBackToNumber as C } from "../../utils/general.js"; import { cn as y } from "../../utils/class.js"; var v = u("<div data-type=calendar-days-area data-scope=date-picker>"); const H = (e) => { return p({ month: e.month, year: e.year, weekStartDay: e.weekStartDay, locale: e.locale || "en-US", setDayRowsArray: e.setDayRowsArray, dayRowsArray: e.dayRowsArray }), t = v(), m(t, o(s, { get each() { return e.dayRowsArray(); }, children: (d, l) => o(g, { get daysRowClass() { var a; return y({ "rn-hidden": ((a = e.showSelectorTwo) == null ? void 0 : a.call(e)) && l() > 0 }, e.daysRowClass); }, get children() { return o(s, { each: d, children: (a) => { const r = C(e.locale || "en-US", a); return o(n, i(() => ({ ...e, calendarWeekDaysNameClass: void 0 }), () => h({ 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; } })); } }); } }) })), c(() => D(t, y("date-picker-calendar-days-area", e.datePickerCalendarDaysArea))), t; var t; }; export { H as CalendarDays };