infinity-ui-elements 1.9.17 → 1.9.19
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/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/Dropdown/DropdownMenu.d.ts +4 -0
- package/dist/components/Dropdown/DropdownMenu.d.ts.map +1 -1
- package/dist/components/SearchableDropdown/SearchableDropdown.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.js +48 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +48 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3138,7 +3138,7 @@ const DateRangePicker = React__namespace.forwardRef(({ className, value: control
|
|
|
3138
3138
|
});
|
|
3139
3139
|
DateRangePicker.displayName = "DateRangePicker";
|
|
3140
3140
|
|
|
3141
|
-
const DropdownMenu = React__namespace.forwardRef(({ items = [], customContent, customContentClassName, sectionHeading, isLoading = false, isEmpty = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText = "Primary", secondaryButtonText = "Secondary", onPrimaryClick, onSecondaryClick, showChevron = false, emptyIcon, disableFooter = false, showFooter, footerLayout = "horizontal", onClose, focusedIndex = -1, className, width = "auto", maxHeight = "400px", }, ref) => {
|
|
3141
|
+
const DropdownMenu = React__namespace.forwardRef(({ items = [], customContent, customContentClassName, sectionHeading, isLoading = false, isEmpty = false, emptyTitle = "No Search Results Found", emptyDescription = "Add description of what the user can search for here.", emptyLinkText = "Link to support site", onEmptyLinkClick, primaryButtonText = "Primary", secondaryButtonText = "Secondary", onPrimaryClick, onSecondaryClick, showChevron = false, emptyIcon, disableFooter = false, showFooter, footerLayout = "horizontal", onClose, focusedIndex = -1, className, width = "auto", maxHeight = "400px", unstyled = false, }, ref) => {
|
|
3142
3142
|
const renderContent = () => {
|
|
3143
3143
|
if (isLoading) {
|
|
3144
3144
|
return (jsxRuntime.jsx("div", { className: "flex flex-col items-center justify-center py-12 px-6", children: jsxRuntime.jsx(lucideReact.Loader2, { className: "w-12 h-12 text-action-ink-primary-normal mb-4 animate-spin" }) }));
|
|
@@ -3156,8 +3156,10 @@ const DropdownMenu = React__namespace.forwardRef(({ items = [], customContent, c
|
|
|
3156
3156
|
};
|
|
3157
3157
|
const widthClass = width === "full" ? "w-full" : width === "auto" ? "w-auto" : "";
|
|
3158
3158
|
const footerVisible = showFooter ?? !disableFooter;
|
|
3159
|
-
return (jsxRuntime.jsxs("div", { ref: ref, className: cn("bg-white
|
|
3160
|
-
|
|
3159
|
+
return (jsxRuntime.jsxs("div", { ref: ref, className: cn(!unstyled && "bg-white rounded-large overflow-hidden", unstyled && "w-full", widthClass, className), style: {
|
|
3160
|
+
...(!unstyled && {
|
|
3161
|
+
boxShadow: "0 1px 2px rgba(25, 25, 30, 0.1), 0 2px 6px rgba(25, 25, 30, 0.06)",
|
|
3162
|
+
}),
|
|
3161
3163
|
...(width !== "full" && width !== "auto" ? { width } : {}),
|
|
3162
3164
|
}, children: [renderContent(), footerVisible && (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsxs("div", { className: cn("flex gap-3 p-4", footerLayout === "vertical"
|
|
3163
3165
|
? "flex-col"
|
|
@@ -3189,6 +3191,18 @@ const Dropdown = React__namespace.forwardRef(({ className, trigger, items = [],
|
|
|
3189
3191
|
right: "auto",
|
|
3190
3192
|
maxHeight: "400px",
|
|
3191
3193
|
});
|
|
3194
|
+
// Detect if we're on mobile (< 768px)
|
|
3195
|
+
const [isMobile, setIsMobile] = React__namespace.useState(false);
|
|
3196
|
+
React__namespace.useEffect(() => {
|
|
3197
|
+
const checkMobile = () => {
|
|
3198
|
+
setIsMobile(window.innerWidth < 768);
|
|
3199
|
+
};
|
|
3200
|
+
// Check on mount
|
|
3201
|
+
checkMobile();
|
|
3202
|
+
// Add resize listener
|
|
3203
|
+
window.addEventListener('resize', checkMobile);
|
|
3204
|
+
return () => window.removeEventListener('resize', checkMobile);
|
|
3205
|
+
}, []);
|
|
3192
3206
|
const handleOpenChange = (newOpen) => {
|
|
3193
3207
|
if (controlledOpen === undefined) {
|
|
3194
3208
|
setUncontrolledOpen(newOpen);
|
|
@@ -3305,14 +3319,18 @@ const Dropdown = React__namespace.forwardRef(({ className, trigger, items = [],
|
|
|
3305
3319
|
medium: "w-80",
|
|
3306
3320
|
large: "w-96",
|
|
3307
3321
|
};
|
|
3308
|
-
|
|
3322
|
+
// Render dropdown menu content wrapped in BottomSheet for mobile
|
|
3323
|
+
const renderDropdownContent = () => (jsxRuntime.jsx(DropdownMenu, { ref: ref, items: items, customContent: customContent, customContentClassName: customContentClassName, sectionHeading: sectionHeading, isLoading: isLoading, isEmpty: isEmpty, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyLinkText: emptyLinkText, onEmptyLinkClick: onEmptyLinkClick, primaryButtonText: primaryButtonText, secondaryButtonText: secondaryButtonText, onPrimaryClick: onPrimaryClick, onSecondaryClick: onSecondaryClick, showChevron: showChevron, emptyIcon: emptyIcon, disableFooter: disableFooter, showFooter: showFooter, onClose: () => handleOpenChange(false), className: className, width: isMobile ? "full" : sizeMap[size], maxHeight: menuPosition.maxHeight, unstyled: isMobile }));
|
|
3324
|
+
return (jsxRuntime.jsxs("div", { ref: dropdownRef, className: cn("relative inline-block", containerClassName), ...props, children: [trigger && (jsxRuntime.jsx("div", { onClick: toggleOpen, className: "cursor-pointer", children: trigger })), isMobile ? (jsxRuntime.jsx(BottomSheet, { isOpen: isOpen, onClose: () => handleOpenChange(false), title: sectionHeading, variant: "default", showDragHandle: true, closeOnOverlayClick: true, closeOnEscape: true, closeOnSwipeDown: true, children: renderDropdownContent() })) : (
|
|
3325
|
+
/* Desktop: Regular Dropdown Menu */
|
|
3326
|
+
isOpen && (jsxRuntime.jsx("div", { ref: menuRef, className: cn("absolute z-50", menuClassName), style: {
|
|
3309
3327
|
top: menuPosition.top,
|
|
3310
3328
|
bottom: menuPosition.bottom,
|
|
3311
3329
|
left: menuPosition.left,
|
|
3312
3330
|
right: menuPosition.right,
|
|
3313
3331
|
marginTop: menuPosition.top === "100%" ? "0.5rem" : "0",
|
|
3314
3332
|
marginBottom: menuPosition.bottom === "100%" ? "0.5rem" : "0",
|
|
3315
|
-
}, children:
|
|
3333
|
+
}, children: renderDropdownContent() })))] }));
|
|
3316
3334
|
});
|
|
3317
3335
|
Dropdown.displayName = "Dropdown";
|
|
3318
3336
|
|
|
@@ -4096,6 +4114,7 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
4096
4114
|
const [isOpen, setIsOpen] = React__namespace.useState(false);
|
|
4097
4115
|
const [focusedIndex, setFocusedIndex] = React__namespace.useState(-1);
|
|
4098
4116
|
const [isInsideModal, setIsInsideModal] = React__namespace.useState(false);
|
|
4117
|
+
const [isMobile, setIsMobile] = React__namespace.useState(false);
|
|
4099
4118
|
const dropdownRef = React__namespace.useRef(null);
|
|
4100
4119
|
const inputRef = React__namespace.useRef(null);
|
|
4101
4120
|
const menuRef = React__namespace.useRef(null);
|
|
@@ -4104,6 +4123,17 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
4104
4123
|
left: 0,
|
|
4105
4124
|
width: 0,
|
|
4106
4125
|
});
|
|
4126
|
+
// Detect if we're on mobile (< 768px)
|
|
4127
|
+
React__namespace.useEffect(() => {
|
|
4128
|
+
const checkMobile = () => {
|
|
4129
|
+
setIsMobile(window.innerWidth < 768);
|
|
4130
|
+
};
|
|
4131
|
+
// Check on mount
|
|
4132
|
+
checkMobile();
|
|
4133
|
+
// Add resize listener
|
|
4134
|
+
window.addEventListener('resize', checkMobile);
|
|
4135
|
+
return () => window.removeEventListener('resize', checkMobile);
|
|
4136
|
+
}, []);
|
|
4107
4137
|
React__namespace.useImperativeHandle(ref, () => inputRef.current);
|
|
4108
4138
|
// Determine current value (controlled or uncontrolled)
|
|
4109
4139
|
const value = controlledValue !== undefined ? controlledValue : uncontrolledValue;
|
|
@@ -4338,15 +4368,18 @@ const SearchableDropdown = React__namespace.forwardRef(({ className, items = [],
|
|
|
4338
4368
|
};
|
|
4339
4369
|
});
|
|
4340
4370
|
const showDropdown = isOpen && searchValue.length >= minSearchLength;
|
|
4341
|
-
|
|
4371
|
+
// Render dropdown menu content
|
|
4372
|
+
const renderDropdownContent = () => (jsxRuntime.jsx(DropdownMenu, { items: itemsWithHandlers, sectionHeading: sectionHeading, isLoading: isLoading, isEmpty: itemsWithAddNew.length === 0 && !showAddNew, emptyTitle: emptyTitle, emptyDescription: emptyDescription, emptyLinkText: emptyLinkText, onEmptyLinkClick: onEmptyLinkClick, primaryButtonText: primaryButtonText, secondaryButtonText: secondaryButtonText, onPrimaryClick: onPrimaryClick, onSecondaryClick: onSecondaryClick, showChevron: showChevron, emptyIcon: emptyIcon, disableFooter: disableFooter, showFooter: (primaryButtonText || secondaryButtonText) && !disableFooter
|
|
4373
|
+
? true
|
|
4374
|
+
: false, footerLayout: footerLayout, onClose: () => setIsOpen(false), focusedIndex: focusedIndex, className: dropdownClassName, width: isMobile ? "full" : (dropdownWidth === "full" ? "full" : "auto"), unstyled: isMobile }));
|
|
4375
|
+
// Mobile: BottomSheet, Desktop: Regular Dropdown
|
|
4376
|
+
const dropdownMenu = showDropdown && (isMobile ? (jsxRuntime.jsx(BottomSheet, { isOpen: isOpen, onClose: () => setIsOpen(false), title: sectionHeading, variant: "default", showDragHandle: true, closeOnOverlayClick: true, closeOnEscape: true, closeOnSwipeDown: true, children: renderDropdownContent() })) : (jsxRuntime.jsx("div", { ref: menuRef, style: {
|
|
4342
4377
|
position: "absolute",
|
|
4343
4378
|
top: `${position.top + 8}px`,
|
|
4344
4379
|
left: `${position.left}px`,
|
|
4345
4380
|
width: dropdownWidth === "full" ? `${position.width}px` : "auto",
|
|
4346
4381
|
zIndex: isInsideModal ? 10001 : 9999,
|
|
4347
|
-
}, children:
|
|
4348
|
-
? true
|
|
4349
|
-
: false, footerLayout: footerLayout, onClose: () => setIsOpen(false), focusedIndex: focusedIndex, className: dropdownClassName, width: dropdownWidth === "full" ? "full" : "auto" }) }));
|
|
4382
|
+
}, children: renderDropdownContent() })));
|
|
4350
4383
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { ref: dropdownRef, className: cn("relative", containerClassName), children: jsxRuntime.jsx(TextField, { ref: inputRef, value: searchValue, onChange: handleSearchChange, onFocus: handleFocus, onKeyDown: handleKeyDown, containerClassName: "mb-0", ...textFieldProps }) }), typeof document !== "undefined" &&
|
|
4351
4384
|
dropdownMenu &&
|
|
4352
4385
|
reactDom.createPortal(dropdownMenu, document.body)] }));
|
|
@@ -4358,12 +4391,12 @@ const SidePanel = React__namespace.forwardRef(({ isOpen, onClose, title, titleIc
|
|
|
4358
4391
|
const contentRef = ref || panelRef;
|
|
4359
4392
|
const [isVisible, setIsVisible] = React__namespace.useState(false);
|
|
4360
4393
|
const [shouldRender, setShouldRender] = React__namespace.useState(false);
|
|
4361
|
-
// Width configurations
|
|
4394
|
+
// Width configurations - full width on mobile, specified width on tablet/desktop
|
|
4362
4395
|
const widthConfig = {
|
|
4363
|
-
small: "w-80",
|
|
4364
|
-
medium: "w-96",
|
|
4365
|
-
large: "w-[32rem]",
|
|
4366
|
-
xlarge: "w-[40rem]",
|
|
4396
|
+
small: "w-full md:w-80",
|
|
4397
|
+
medium: "w-full md:w-96",
|
|
4398
|
+
large: "w-full md:w-[32rem]",
|
|
4399
|
+
xlarge: "w-full md:w-[40rem]",
|
|
4367
4400
|
};
|
|
4368
4401
|
// Handle mounting and unmounting with animation
|
|
4369
4402
|
React__namespace.useEffect(() => {
|
|
@@ -4435,7 +4468,7 @@ const SidePanel = React__namespace.forwardRef(({ isOpen, onClose, title, titleIc
|
|
|
4435
4468
|
const widthClass = width in widthConfig
|
|
4436
4469
|
? widthConfig[width]
|
|
4437
4470
|
: width;
|
|
4438
|
-
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-9999 flex p-4", positionClasses[position].container, className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsxRuntime.jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-300", isVisible ? "opacity-100" : "opacity-0", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative bg-white shadow-2xl transition-transform duration-300 ease-out rounded-large", "flex flex-col max-w-full overflow-hidden", position === "center" ? "max-h-[90vh]" : "h-full", widthClass, positionClasses[position].panel, contentClassName), children: [hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between gap-4 px-7 py-5 shrink-0 border-b border-surface-outline-neutral-subtle", headerClassName), children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [titleIcon && (jsxRuntime.jsx("div", { className: "flex items-center justify-center shrink-0", children: typeof titleIcon === "string" ? (jsxRuntime.jsx(Icon, { name: titleIcon, size: 20 })) : (titleIcon) })), jsxRuntime.jsxs("div", { className: "flex flex-col flex-1 min-w-0", children: [title && (jsxRuntime.jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", className: "truncate", children: title })), description && (jsxRuntime.jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-0.5", children: description }))] })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [headerActions, showCloseButton && onClose && (jsxRuntime.jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close side panel" }))] })] })), !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 side panel" }) })), jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto px-6", hasHeader ? "py-6" : "pt-6 pb-4", !footer && "pb-6", bodyClassName), children: children }), footer && (jsxRuntime.jsxs("div", { className: "flex flex-col shrink-0", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
|
|
4471
|
+
return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-9999 flex p-0 md:p-4", positionClasses[position].container, className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsxRuntime.jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-300", isVisible ? "opacity-100" : "opacity-0", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative bg-white shadow-2xl transition-transform duration-300 ease-out rounded-none md:rounded-large", "flex flex-col max-w-full overflow-hidden", position === "center" ? "max-h-[90vh]" : "h-full", widthClass, positionClasses[position].panel, contentClassName), children: [hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-center justify-between gap-4 px-7 py-5 shrink-0 border-b border-surface-outline-neutral-subtle", headerClassName), children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [titleIcon && (jsxRuntime.jsx("div", { className: "flex items-center justify-center shrink-0", children: typeof titleIcon === "string" ? (jsxRuntime.jsx(Icon, { name: titleIcon, size: 20 })) : (titleIcon) })), jsxRuntime.jsxs("div", { className: "flex flex-col flex-1 min-w-0", children: [title && (jsxRuntime.jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", className: "truncate", children: title })), description && (jsxRuntime.jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-0.5", children: description }))] })] }), jsxRuntime.jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [headerActions, showCloseButton && onClose && (jsxRuntime.jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close side panel" }))] })] })), !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 side panel" }) })), jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto px-6", hasHeader ? "py-6" : "pt-6 pb-4", !footer && "pb-6", bodyClassName), children: children }), footer && (jsxRuntime.jsxs("div", { className: "flex flex-col shrink-0", children: [jsxRuntime.jsx(Divider, { thickness: "thin", variant: "muted" }), jsxRuntime.jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
|
|
4439
4472
|
});
|
|
4440
4473
|
SidePanel.displayName = "SidePanel";
|
|
4441
4474
|
|