nearpay-datepicker-react 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +25 -23
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +25 -23
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2370,10 +2370,10 @@ const Days = (props) => {
|
|
|
2370
2370
|
className = ` ${BG_COLOR["500"][primaryColor]} text-white font-medium rounded-full`;
|
|
2371
2371
|
}
|
|
2372
2372
|
else if (dayIsSameStart) {
|
|
2373
|
-
className = ` ${BG_COLOR["500"][primaryColor]} text-white font-medium ${dayIsSameHoverDay && !period.end ? "rounded-full" : "rounded-
|
|
2373
|
+
className = ` ${BG_COLOR["500"][primaryColor]} text-white font-medium ${dayIsSameHoverDay && !period.end ? "rounded-full" : "rounded-s-full"}`;
|
|
2374
2374
|
}
|
|
2375
2375
|
else if (dayIsSameEnd) {
|
|
2376
|
-
className = ` ${BG_COLOR["500"][primaryColor]} text-white font-medium ${dayIsSameHoverDay && !period.start ? "rounded-full" : "rounded-
|
|
2376
|
+
className = ` ${BG_COLOR["500"][primaryColor]} text-white font-medium ${dayIsSameHoverDay && !period.start ? "rounded-full" : "rounded-e-full"}`;
|
|
2377
2377
|
}
|
|
2378
2378
|
return {
|
|
2379
2379
|
active: dayIsSameStart || dayIsSameEnd,
|
|
@@ -2400,7 +2400,7 @@ const Days = (props) => {
|
|
|
2400
2400
|
}
|
|
2401
2401
|
if (dateIsSame(dayHover, day, "date")) {
|
|
2402
2402
|
const bgColor = BG_COLOR["500"][primaryColor];
|
|
2403
|
-
className = ` transition-all duration-500 text-white font-medium ${bgColor} ${period.start ? "rounded-
|
|
2403
|
+
className = ` transition-all duration-500 text-white font-medium ${bgColor} ${period.start ? "rounded-e-full" : "rounded-s-full"}`;
|
|
2404
2404
|
}
|
|
2405
2405
|
return className;
|
|
2406
2406
|
}, [currentDateClass, dayHover, period.end, period.start, primaryColor]);
|
|
@@ -2752,9 +2752,9 @@ const Calendar = (props) => {
|
|
|
2752
2752
|
max: maxDate && dateIsValid(maxDate) ? maxDate.getFullYear() : null
|
|
2753
2753
|
};
|
|
2754
2754
|
}, [maxDate, minDate]);
|
|
2755
|
-
return (jsxRuntimeExports.jsxs("div", { className: "w-full md:w-[296px] md:min-w-[296px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center
|
|
2755
|
+
return (jsxRuntimeExports.jsxs("div", { className: "w-full md:w-[296px] md:min-w-[296px]", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 border border-gray-300 dark:border-zinc-700 rounded-md px-2 py-1.5", children: [!showMonths && !showYears && (jsxRuntimeExports.jsx("div", { className: "flex-none", children: jsxRuntimeExports.jsx(RoundedButton, { roundedFull: true, onClick: onClickPrevious, children: jsxRuntimeExports.jsx(ChevronLeftIcon, { className: "h-5 w-5 rtl:rotate-180" }) }) })), showYears && (jsxRuntimeExports.jsx("div", { className: "flex-none", children: jsxRuntimeExports.jsx(RoundedButton, { roundedFull: true, onClick: () => {
|
|
2756
2756
|
setYear(year - NUMBER_YEARS_SHOW);
|
|
2757
|
-
}, children: jsxRuntimeExports.jsx(DoubleChevronLeftIcon, { className: "h-5 w-5" }) }) })), jsxRuntimeExports.jsxs("div", { className: "flex flex-1 items-center
|
|
2757
|
+
}, children: jsxRuntimeExports.jsx(DoubleChevronLeftIcon, { className: "h-5 w-5 rtl:rotate-180" }) }) })), jsxRuntimeExports.jsxs("div", { className: "flex flex-1 items-center gap-1.5", children: [jsxRuntimeExports.jsx("div", { className: "w-1/2", children: jsxRuntimeExports.jsx(RoundedButton, { onClick: () => {
|
|
2758
2758
|
setShowMonths(!showMonths);
|
|
2759
2759
|
hideYears();
|
|
2760
2760
|
}, children: dateFormat(date, "MMM", i18n) }) }), jsxRuntimeExports.jsx("div", { className: "w-1/2", children: jsxRuntimeExports.jsx(RoundedButton, { onClick: () => {
|
|
@@ -2762,7 +2762,7 @@ const Calendar = (props) => {
|
|
|
2762
2762
|
hideMonths();
|
|
2763
2763
|
}, children: jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: date.getFullYear() }) }) })] }), showYears && (jsxRuntimeExports.jsx("div", { className: "flex-none", children: jsxRuntimeExports.jsx(RoundedButton, { roundedFull: true, onClick: () => {
|
|
2764
2764
|
setYear(year + NUMBER_YEARS_SHOW);
|
|
2765
|
-
}, children: jsxRuntimeExports.jsx(DoubleChevronRightIcon, { className: "h-5 w-5" }) }) })), !showMonths && !showYears && (jsxRuntimeExports.jsx("div", { className: "flex-none", children: jsxRuntimeExports.jsx(RoundedButton, { roundedFull: true, onClick: onClickNext, children: jsxRuntimeExports.jsx(ChevronRightIcon, { className: "h-5 w-5" }) }) }))] }), jsxRuntimeExports.jsxs("div", { className: "px-0.5 sm:px-2 mt-0.5 min-h-[285px]", children: [showMonths && (jsxRuntimeExports.jsx(Months, { currentMonth: date.getMonth() + 1, clickMonth: clickMonth })), showYears && (jsxRuntimeExports.jsx(Years, { year: year, minYear: years.min, maxYear: years.max, currentYear: date.getFullYear(), clickYear: clickYear })), !showMonths && !showYears && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Week, {}), jsxRuntimeExports.jsx(Days, { days: calendarData, onClickPreviousDays: clickPreviousDays, onClickDay: clickDay, onClickNextDays: clickNextDays })] }))] })] }));
|
|
2765
|
+
}, children: jsxRuntimeExports.jsx(DoubleChevronRightIcon, { className: "h-5 w-5 rtl:rotate-180" }) }) })), !showMonths && !showYears && (jsxRuntimeExports.jsx("div", { className: "flex-none", children: jsxRuntimeExports.jsx(RoundedButton, { roundedFull: true, onClick: onClickNext, children: jsxRuntimeExports.jsx(ChevronRightIcon, { className: "h-5 w-5 rtl:rotate-180" }) }) }))] }), jsxRuntimeExports.jsxs("div", { className: "px-0.5 sm:px-2 mt-0.5 min-h-[285px]", children: [showMonths && (jsxRuntimeExports.jsx(Months, { currentMonth: date.getMonth() + 1, clickMonth: clickMonth })), showYears && (jsxRuntimeExports.jsx(Years, { year: year, minYear: years.min, maxYear: years.max, currentYear: date.getFullYear(), clickYear: clickYear })), !showMonths && !showYears && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Week, {}), jsxRuntimeExports.jsx(Days, { days: calendarData, onClickPreviousDays: clickPreviousDays, onClickDay: clickDay, onClickNextDays: clickNextDays })] }))] })] }));
|
|
2766
2766
|
};
|
|
2767
2767
|
|
|
2768
2768
|
const PrimaryButton = (props) => {
|
|
@@ -2802,7 +2802,7 @@ const Footer = () => {
|
|
|
2802
2802
|
}
|
|
2803
2803
|
return "flex items-center justify-end pb-2.5 pt-3 border-t border-gray-300 dark:border-zinc-700";
|
|
2804
2804
|
}, [classNames]);
|
|
2805
|
-
return (jsxRuntimeExports.jsx("div", { className: getClassName(), children: jsxRuntimeExports.jsxs("div", { className: "w-full md:w-auto flex items-center justify-center
|
|
2805
|
+
return (jsxRuntimeExports.jsx("div", { className: getClassName(), children: jsxRuntimeExports.jsxs("div", { className: "w-full md:w-auto flex items-center justify-center gap-3", children: [jsxRuntimeExports.jsx(SecondaryButton, { onClick: () => {
|
|
2806
2806
|
hideDatepicker();
|
|
2807
2807
|
}, children: jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: configs?.footer?.cancel ? configs.footer.cancel : "Cancel" }) }), jsxRuntimeExports.jsx(PrimaryButton, { onClick: () => {
|
|
2808
2808
|
if (period.start && period.end) {
|
|
@@ -2843,7 +2843,7 @@ const Input = (e) => {
|
|
|
2843
2843
|
}
|
|
2844
2844
|
const border = BORDER_COLOR.focus[primaryColor];
|
|
2845
2845
|
const ring = RING_COLOR["second-focus"][primaryColor];
|
|
2846
|
-
const defaultInputClassName = `relative transition-all duration-300 py-2.5
|
|
2846
|
+
const defaultInputClassName = `relative transition-all duration-300 py-2.5 ps-4 pe-14 w-full border-gray-300 dark:bg-zinc-800 dark:text-white/80 dark:border-zinc-700 rounded-lg tracking-wide font-light text-sm placeholder-gray-400 bg-white focus:ring-3 disabled:opacity-40 disabled:cursor-not-allowed ${border} ${ring}`;
|
|
2847
2847
|
return typeof inputClassName === "function"
|
|
2848
2848
|
? inputClassName(defaultInputClassName)
|
|
2849
2849
|
: typeof inputClassName === "string" && inputClassName !== ""
|
|
@@ -2912,7 +2912,7 @@ const Input = (e) => {
|
|
|
2912
2912
|
typeof classNames?.toggleButton === "function") {
|
|
2913
2913
|
return classNames.toggleButton(button);
|
|
2914
2914
|
}
|
|
2915
|
-
const defaultToggleClassName = "absolute
|
|
2915
|
+
const defaultToggleClassName = "absolute end-0 h-full px-3 text-gray-400 focus:outline-hidden disabled:opacity-40 disabled:cursor-not-allowed";
|
|
2916
2916
|
return typeof toggleClassName === "function"
|
|
2917
2917
|
? toggleClassName(defaultToggleClassName)
|
|
2918
2918
|
: typeof toggleClassName === "string" && toggleClassName !== ""
|
|
@@ -2987,9 +2987,9 @@ const Input = (e) => {
|
|
|
2987
2987
|
div.classList.add("mb-2.5");
|
|
2988
2988
|
div.classList.remove("mt-2.5");
|
|
2989
2989
|
arrow.classList.add("-bottom-2");
|
|
2990
|
-
arrow.classList.add("border-
|
|
2990
|
+
arrow.classList.add("border-e");
|
|
2991
2991
|
arrow.classList.add("border-b");
|
|
2992
|
-
arrow.classList.remove("border-
|
|
2992
|
+
arrow.classList.remove("border-s");
|
|
2993
2993
|
arrow.classList.remove("border-t");
|
|
2994
2994
|
}
|
|
2995
2995
|
setTimeout(() => {
|
|
@@ -3147,7 +3147,7 @@ const Shortcuts = () => {
|
|
|
3147
3147
|
const printItemText = require$$0.useCallback((item) => {
|
|
3148
3148
|
return item?.text ?? null;
|
|
3149
3149
|
}, []);
|
|
3150
|
-
return shortcutOptions?.length ? (jsxRuntimeExports.jsx("div", { className: "md:border-b mb-3 lg:mb-0 lg:border-
|
|
3150
|
+
return shortcutOptions?.length ? (jsxRuntimeExports.jsx("div", { className: "md:border-b mb-3 lg:mb-0 lg:border-e lg:border-b-0 border-gray-300 dark:border-zinc-700 pe-1", children: jsxRuntimeExports.jsx("ul", { className: "w-full tracking-wide flex flex-wrap lg:flex-col pb-1 lg:pb-0", children: shortcutOptions.map(([key, item], index) => Array.isArray(item) ? (item.map((item, index) => (jsxRuntimeExports.jsx(ItemTemplate, { item: item, children: jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: key === "past" &&
|
|
3151
3151
|
configs?.shortcuts &&
|
|
3152
3152
|
key in configs.shortcuts &&
|
|
3153
3153
|
item.daysNumber
|
|
@@ -3177,7 +3177,7 @@ function useOnClickOutside(ref, handler) {
|
|
|
3177
3177
|
}
|
|
3178
3178
|
|
|
3179
3179
|
const Arrow = require$$0.forwardRef((props, ref) => {
|
|
3180
|
-
return (jsxRuntimeExports.jsx("div", { ...props, ref: ref, className: "absolute z-20 h-4 w-4 rotate-45 mt-0.5
|
|
3180
|
+
return (jsxRuntimeExports.jsx("div", { ...props, ref: ref, className: "absolute z-20 h-4 w-4 rotate-45 mt-0.5 ms-[1.2rem] border-s border-t border-gray-300 bg-white dark:bg-zinc-800 dark:border-zinc-700" }));
|
|
3181
3181
|
});
|
|
3182
3182
|
Arrow.displayName = "Arrow";
|
|
3183
3183
|
|
|
@@ -3228,9 +3228,9 @@ const Datepicker = (props) => {
|
|
|
3228
3228
|
div.classList.add("mb-2.5");
|
|
3229
3229
|
div.classList.add("mt-2.5");
|
|
3230
3230
|
arrow.classList.remove("-bottom-2");
|
|
3231
|
-
arrow.classList.remove("border-
|
|
3231
|
+
arrow.classList.remove("border-e");
|
|
3232
3232
|
arrow.classList.remove("border-b");
|
|
3233
|
-
arrow.classList.add("border-
|
|
3233
|
+
arrow.classList.add("border-s");
|
|
3234
3234
|
arrow.classList.add("border-t");
|
|
3235
3235
|
}, 300);
|
|
3236
3236
|
}
|
|
@@ -3287,14 +3287,16 @@ const Datepicker = (props) => {
|
|
|
3287
3287
|
const containerCenter = (detail.right - detail.x) / 2 + detail.x;
|
|
3288
3288
|
const isRTL = i18n === "ar";
|
|
3289
3289
|
const alignRight = () => {
|
|
3290
|
-
arrow.classList.
|
|
3291
|
-
arrow.classList.add("
|
|
3292
|
-
|
|
3290
|
+
arrow.classList.remove("ms-[1.2rem]");
|
|
3291
|
+
arrow.classList.add("end-0");
|
|
3292
|
+
arrow.classList.add("me-3.5");
|
|
3293
|
+
calendarContainer.classList.add("end-0");
|
|
3293
3294
|
};
|
|
3294
3295
|
const alignLeft = () => {
|
|
3295
|
-
arrow.classList.
|
|
3296
|
-
arrow.classList.remove("
|
|
3297
|
-
|
|
3296
|
+
arrow.classList.add("ms-[1.2rem]");
|
|
3297
|
+
arrow.classList.remove("end-0");
|
|
3298
|
+
arrow.classList.remove("me-3.5");
|
|
3299
|
+
calendarContainer.classList.remove("end-0");
|
|
3298
3300
|
};
|
|
3299
3301
|
if (popoverDirection === "down-left" || popoverDirection === "up-left") {
|
|
3300
3302
|
if (isRTL) {
|
|
@@ -3321,7 +3323,7 @@ const Datepicker = (props) => {
|
|
|
3321
3323
|
}
|
|
3322
3324
|
}
|
|
3323
3325
|
}
|
|
3324
|
-
}, [popoverDirection]);
|
|
3326
|
+
}, [popoverDirection, i18n]);
|
|
3325
3327
|
require$$0.useEffect(() => {
|
|
3326
3328
|
if (value && value.startDate && value.endDate) {
|
|
3327
3329
|
if (dateIsSameOrBefore(value.startDate, value.endDate, "date")) {
|
|
@@ -3478,7 +3480,7 @@ const Datepicker = (props) => {
|
|
|
3478
3480
|
? popupClassName
|
|
3479
3481
|
: defaultPopupClassName;
|
|
3480
3482
|
}, [popupClassName]);
|
|
3481
|
-
return (jsxRuntimeExports.jsx(DatepickerContext.Provider, { value: contextValues, children: jsxRuntimeExports.jsxs("div", { className: containerClassNameOverload, ref: containerRef, children: [jsxRuntimeExports.jsx(Input, { setContextRef: setInputRef }), jsxRuntimeExports.jsxs("div", { className: popupClassNameOverload, ref: calendarContainerRef, children: [jsxRuntimeExports.jsx(Arrow, { ref: arrowRef }), jsxRuntimeExports.jsxs("div", { className: "mt-2.5 shadow-xs border border-gray-300 px-1 py-0.5 bg-white dark:bg-zinc-800 dark:text-white dark:border-zinc-700 rounded-lg", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col lg:flex-row py-2", children: [showShortcuts && jsxRuntimeExports.jsx(Shortcuts, {}), jsxRuntimeExports.jsxs("div", { className: `flex items-stretch flex-col md:flex-row space-y-4 md:space-y-0 md:
|
|
3483
|
+
return (jsxRuntimeExports.jsx(DatepickerContext.Provider, { value: contextValues, children: jsxRuntimeExports.jsxs("div", { className: containerClassNameOverload, ref: containerRef, children: [jsxRuntimeExports.jsx(Input, { setContextRef: setInputRef }), jsxRuntimeExports.jsxs("div", { className: popupClassNameOverload, ref: calendarContainerRef, children: [jsxRuntimeExports.jsx(Arrow, { ref: arrowRef }), jsxRuntimeExports.jsxs("div", { className: "mt-2.5 shadow-xs border border-gray-300 px-1 py-0.5 bg-white dark:bg-zinc-800 dark:text-white dark:border-zinc-700 rounded-lg", children: [jsxRuntimeExports.jsxs("div", { className: "flex flex-col lg:flex-row py-2", children: [showShortcuts && jsxRuntimeExports.jsx(Shortcuts, {}), jsxRuntimeExports.jsxs("div", { className: `flex items-stretch flex-col md:flex-row space-y-4 md:space-y-0 md:gap-x-1.5 ${showShortcuts ? "md:ps-2" : "md:ps-1"} pe-2 lg:pe-1`, children: [jsxRuntimeExports.jsx(Calendar, { date: firstDate, onClickPrevious: previousMonthFirst, onClickNext: nextMonthFirst, changeMonth: changeFirstMonth, changeYear: changeFirstYear, minDate: minDate, maxDate: maxDate }), useRange && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("div", { className: "flex items-center", children: jsxRuntimeExports.jsx(VerticalDash, {}) }), jsxRuntimeExports.jsx(Calendar, { date: secondDate, onClickPrevious: previousMonthSecond, onClickNext: nextMonthSecond, changeMonth: changeSecondMonth, changeYear: changeSecondYear, minDate: minDate, maxDate: maxDate })] }))] })] }), showFooter && jsxRuntimeExports.jsx(Footer, {})] })] })] }) }));
|
|
3482
3484
|
};
|
|
3483
3485
|
|
|
3484
3486
|
var af$1 = {exports: {}};
|