infinity-ui-elements 1.9.4 → 1.9.6
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/components/DateRangePicker/DateRangePicker.d.ts +14 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +15 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2666,7 +2666,7 @@ const formatMonthYear = (date) => {
|
|
|
2666
2666
|
year: "numeric",
|
|
2667
2667
|
});
|
|
2668
2668
|
};
|
|
2669
|
-
const DateRangePicker = React__namespace.forwardRef(({ className, value: controlledValue, defaultValue, onChange, placeholder = "Select date range", isDisabled = false, size = "medium", triggerClassName, calendarClassName, minDate, maxDate, formatDate = formatDateDefault, presets = defaultPresets, showPresets = true, selectedPresetLabel, ...props }, ref) => {
|
|
2669
|
+
const DateRangePicker = React__namespace.forwardRef(({ className, value: controlledValue, defaultValue, onChange, placeholder = "Select date range", isDisabled = false, size = "medium", trigger, renderTrigger, triggerClassName, calendarClassName, minDate, maxDate, formatDate = formatDateDefault, presets = defaultPresets, showPresets = true, selectedPresetLabel, ...props }, ref) => {
|
|
2670
2670
|
const [uncontrolledValue, setUncontrolledValue] = React__namespace.useState(defaultValue || { startDate: null, endDate: null });
|
|
2671
2671
|
const [tempValue, setTempValue] = React__namespace.useState(defaultValue || { startDate: null, endDate: null });
|
|
2672
2672
|
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
@@ -2889,14 +2889,19 @@ const DateRangePicker = React__namespace.forwardRef(({ className, value: control
|
|
|
2889
2889
|
}
|
|
2890
2890
|
return placeholder;
|
|
2891
2891
|
};
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2892
|
+
const displayText = getDisplayText();
|
|
2893
|
+
// Render custom trigger if provided
|
|
2894
|
+
const triggerElement = renderTrigger ? (renderTrigger({ displayText, isOpen, onClick: toggleOpen })) : trigger ? (jsxRuntime.jsx("div", { onClick: !isDisabled ? toggleOpen : undefined, children: trigger })) : (
|
|
2895
|
+
// Default trigger
|
|
2896
|
+
jsxRuntime.jsxs("div", { className: cn(dateRangePickerVariants({
|
|
2897
|
+
size,
|
|
2898
|
+
isDisabled,
|
|
2899
|
+
}), "cursor-pointer", triggerClassName), onClick: !isDisabled ? toggleOpen : undefined, role: "button", "aria-haspopup": "dialog", "aria-expanded": isOpen, "aria-disabled": isDisabled, ...props, children: [jsxRuntime.jsx(lucideReact.Calendar, { className: cn("shrink-0 w-4 h-4", isDisabled
|
|
2900
|
+
? "text-surface-ink-neutral-disabled"
|
|
2901
|
+
: "text-surface-ink-neutral-muted") }), jsxRuntime.jsx("span", { className: cn("flex-1 text-left truncate", !hasValue && "text-surface-ink-neutral-muted", isDisabled && "text-surface-ink-neutral-disabled"), children: displayText }), jsxRuntime.jsx(Icon, { name: "chevronDown", size: 16, className: cn("shrink-0 transition-transform", isDisabled
|
|
2902
|
+
? "text-surface-ink-neutral-disabled"
|
|
2903
|
+
: "text-surface-ink-neutral-muted", isOpen && "rotate-180") })] }));
|
|
2904
|
+
return (jsxRuntime.jsxs("div", { ref: datePickerRef, className: cn("relative w-fit", className), children: [triggerElement, typeof document !== "undefined" &&
|
|
2900
2905
|
isOpen &&
|
|
2901
2906
|
!isDisabled &&
|
|
2902
2907
|
(() => {
|
|
@@ -3276,7 +3281,7 @@ const Modal = React__namespace.forwardRef(({ isOpen, onClose, title, description
|
|
|
3276
3281
|
if (!isOpen)
|
|
3277
3282
|
return null;
|
|
3278
3283
|
const hasHeader = title || description;
|
|
3279
|
-
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-9999 flex items-center justify-center p-4", className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsxRuntime.jsx("div", { className: cn("absolute inset-0 z-0 bg-black/50 backdrop-blur-sm transition-opacity", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative transition-all z-10", "flex flex-col max-h-[90vh]", variant === "default" && "w-full bg-white rounded-large shadow-xl", variant === "default" && sizeConfig[size], contentClassName), children: [hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-4
|
|
3284
|
+
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-9999 flex items-center justify-center p-4", className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsxRuntime.jsx("div", { className: cn("absolute inset-0 z-0 bg-black/50 backdrop-blur-sm transition-opacity", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative transition-all z-10", "flex flex-col max-h-[90vh]", variant === "default" && "w-full bg-white rounded-large shadow-xl", variant === "default" && sizeConfig[size], contentClassName), children: [hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-4 px-6 pt-6", !description && "pb-4", description && "pb-2", headerClassName), children: [jsxRuntime.jsxs("div", { className: "flex-1", children: [title && (jsxRuntime.jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", children: title })), description && (jsxRuntime.jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-1", children: description }))] }), showCloseButton && onClose && (jsxRuntime.jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal", className: "shrink-0" }))] })), !hasHeader && showCloseButton && onClose && (jsxRuntime.jsx("div", { className: "absolute top-4 right-4 z-10", children: jsxRuntime.jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close modal" }) })), jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto", variant === "default" && "px-6", variant === "default" && hasHeader && "py-4", variant === "default" && !hasHeader && "pt-6 pb-4", variant === "default" && !footer && "pb-6", bodyClassName), children: children }), footer && (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [variant === "default" && (jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" })), jsxRuntime.jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 pt-5 pb-6", footerClassName), children: footer })] }))] })] }));
|
|
3280
3285
|
});
|
|
3281
3286
|
Modal.displayName = "Modal";
|
|
3282
3287
|
|