infinity-ui-elements 1.8.42 → 1.8.44

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.esm.js CHANGED
@@ -3800,6 +3800,68 @@ const SearchableDropdown = React.forwardRef(({ className, items = [], sectionHea
3800
3800
  });
3801
3801
  SearchableDropdown.displayName = "SearchableDropdown";
3802
3802
 
3803
+ const SidePanel = React.forwardRef(({ isOpen, onClose, title, titleIcon, description, footer, children, position = "right", width = "medium", showCloseButton = true, headerActions, closeOnOverlayClick = true, closeOnEscape = true, className, contentClassName, headerClassName, bodyClassName, footerClassName, overlayClassName, ariaLabel, ariaDescribedBy, }, ref) => {
3804
+ const panelRef = React.useRef(null);
3805
+ const contentRef = ref || panelRef;
3806
+ // Width configurations
3807
+ const widthConfig = {
3808
+ small: "w-80",
3809
+ medium: "w-96",
3810
+ large: "w-[32rem]",
3811
+ xlarge: "w-[40rem]",
3812
+ };
3813
+ // Position-based classes
3814
+ const positionClasses = {
3815
+ left: {
3816
+ container: "justify-start",
3817
+ panel: isOpen ? "animate-slide-in-left" : "animate-slide-out-left",
3818
+ },
3819
+ right: {
3820
+ container: "justify-end",
3821
+ panel: isOpen ? "animate-slide-in-right" : "animate-slide-out-right",
3822
+ },
3823
+ };
3824
+ // Handle escape key
3825
+ React.useEffect(() => {
3826
+ if (!isOpen || !closeOnEscape || !onClose)
3827
+ return;
3828
+ const handleEscape = (e) => {
3829
+ if (e.key === "Escape") {
3830
+ onClose();
3831
+ }
3832
+ };
3833
+ document.addEventListener("keydown", handleEscape);
3834
+ return () => document.removeEventListener("keydown", handleEscape);
3835
+ }, [isOpen, closeOnEscape, onClose]);
3836
+ // Prevent body scroll when side panel is open
3837
+ React.useEffect(() => {
3838
+ if (isOpen) {
3839
+ document.body.style.overflow = "hidden";
3840
+ }
3841
+ else {
3842
+ document.body.style.overflow = "";
3843
+ }
3844
+ return () => {
3845
+ document.body.style.overflow = "";
3846
+ };
3847
+ }, [isOpen]);
3848
+ // Handle overlay click
3849
+ const handleOverlayClick = (e) => {
3850
+ if (closeOnOverlayClick && e.target === e.currentTarget && onClose) {
3851
+ onClose();
3852
+ }
3853
+ };
3854
+ // Don't render if not open
3855
+ if (!isOpen)
3856
+ return null;
3857
+ const hasHeader = title || description;
3858
+ const widthClass = width in widthConfig
3859
+ ? widthConfig[width]
3860
+ : width;
3861
+ return (jsxs("div", { className: cn("fixed inset-0 z-10000 flex items-stretch", positionClasses[position].container, className), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel || title, "aria-describedby": ariaDescribedBy, children: [jsx("div", { className: cn("absolute inset-0 bg-black/50 backdrop-blur-sm transition-opacity duration-300", isOpen ? "opacity-100" : "opacity-0", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxs("div", { ref: contentRef, className: cn("relative bg-white shadow-2xl transition-transform duration-300 ease-out", "flex flex-col h-full max-w-full", widthClass, positionClasses[position].panel, contentClassName), children: [hasHeader && (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: [jsxs("div", { className: "flex items-center gap-3 flex-1 min-w-0", children: [titleIcon && (jsx("div", { className: "flex items-center justify-center shrink-0", children: typeof titleIcon === "string" ? (jsx(Icon, { name: titleIcon, size: 20 })) : (titleIcon) })), jsxs("div", { className: "flex flex-col flex-1 min-w-0", children: [title && (jsx(Text, { as: "h2", variant: "body", size: "large", weight: "semibold", color: "default", className: "truncate", children: title })), description && (jsx(Text, { as: "p", variant: "body", size: "small", weight: "regular", color: "subtle", className: "mt-0.5", children: description }))] })] }), jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [headerActions, showCloseButton && onClose && (jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close side panel" }))] })] })), !hasHeader && showCloseButton && onClose && (jsx("div", { className: "absolute top-4 right-4 z-10", children: jsx(IconButton, { icon: "close", onClick: onClose, color: "neutral", size: "small", "aria-label": "Close side panel" }) })), 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 && (jsxs("div", { className: "flex flex-col shrink-0", children: [jsx(Divider, { thickness: "thin", variant: "muted" }), jsx("div", { className: cn("flex items-center justify-end gap-3 px-6 py-4", footerClassName), children: footer })] }))] })] }));
3862
+ });
3863
+ SidePanel.displayName = "SidePanel";
3864
+
3803
3865
  const variantDefaults = {
3804
3866
  rect: { height: 16, className: "w-full rounded-large" },
3805
3867
  text: { height: 12, className: "w-full rounded-large" },
@@ -4299,8 +4361,8 @@ function TableBody({ rows, enableRowSelection, size, variant, showRowHover, cell
4299
4361
  "bg-surface-fill-neutral-moderate", onRowClick && "cursor-pointer", isRowHovered &&
4300
4362
  showRowHover &&
4301
4363
  "bg-surface-fill-neutral-moderate", getRowClassName(row.original)), onClick: handleClick, onMouseEnter: () => setHoveredRow(row.id), onMouseLeave: () => setHoveredRow(null), children: [enableRowSelection && (jsx("td", { className: cn(tableCellVariants({ size }), "w-10", cellClassName), style: {
4302
- paddingTop: "20px",
4303
- paddingBottom: "20px",
4364
+ paddingTop: "16px",
4365
+ paddingBottom: "16px",
4304
4366
  }, children: jsx(Checkbox, { checked: row.getIsSelected(), isIndeterminate: row.getIsSomeSelected(), onChange: row.getToggleSelectedHandler(), onClick: (e) => e.stopPropagation(), "aria-label": `Select row ${row.id}` }) })), row.getVisibleCells().map((cell, cellIndex) => {
4305
4367
  const isCellFocused = focusedCell?.rowId === row.id &&
4306
4368
  focusedCell?.cellId === cell.id;
@@ -4314,10 +4376,10 @@ function TableBody({ rows, enableRowSelection, size, variant, showRowHover, cell
4314
4376
  minWidth: cell.column.columnDef.minSize,
4315
4377
  maxWidth: cell.column.columnDef.maxSize,
4316
4378
  }),
4317
- paddingTop: "20px",
4318
- paddingBottom: "20px",
4379
+ paddingTop: "16px",
4380
+ paddingBottom: "16px",
4319
4381
  ...(isFirstCell && { paddingLeft: "24px" }),
4320
- ...(isLastCell && { paddingRight: "24px" }),
4382
+ ...(isLastCell && { paddingRight: "16px" }),
4321
4383
  }, tabIndex: 0, onFocus: () => setFocusedCell({ rowId: row.id, cellId: cell.id }), onBlur: () => setFocusedCell(null), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id));
4322
4384
  })] }, row.id));
4323
4385
  }) }));
@@ -5007,5 +5069,5 @@ const UploadBox = React.forwardRef(({ label, helperText, errorText, successText,
5007
5069
  });
5008
5070
  UploadBox.displayName = "UploadBox";
5009
5071
 
5010
- export { Alert, Amount, Avatar, AvatarCell, Badge, Button, ButtonGroup, Checkbox, Counter, DatePicker, Divider, Dropdown, DropdownMenu, FormFooter, FormHeader, Icon, IconButton, IconCell, Link, ListItem, Modal, NumberCell, Pagination, Radio, RadioGroup, SearchableDropdown, Select, SelectTextField, Skeleton, SlotCell, SpacerCell, Switch, TabItem, Table, TableDetailPanel, Tabs, Text, TextArea, TextField, Tooltip, UploadBox, alertVariants, avatarVariants, badgeVariants, buttonGroupVariants, buttonVariants, checkboxVariants, cn, counterVariants, datePickerVariants, dropdownVariants, getAvailableIcons, hasIcon, iconButtonVariants, iconRegistry, linkVariants, listItemVariants, paginationVariants, radioVariants, selectTriggerVariants, selectVariants, switchVariants, tableCellVariants, tableHeaderVariants, tableVariants, textAreaVariants, textFieldVariants, tooltipVariants, uploadBoxVariants };
5072
+ export { Alert, Amount, Avatar, AvatarCell, Badge, Button, ButtonGroup, Checkbox, Counter, DatePicker, Divider, Dropdown, DropdownMenu, FormFooter, FormHeader, Icon, IconButton, IconCell, Link, ListItem, Modal, NumberCell, Pagination, Radio, RadioGroup, SearchableDropdown, Select, SelectTextField, SidePanel, Skeleton, SlotCell, SpacerCell, Switch, TabItem, Table, TableDetailPanel, Tabs, Text, TextArea, TextField, Tooltip, UploadBox, alertVariants, avatarVariants, badgeVariants, buttonGroupVariants, buttonVariants, checkboxVariants, cn, counterVariants, datePickerVariants, dropdownVariants, getAvailableIcons, hasIcon, iconButtonVariants, iconRegistry, linkVariants, listItemVariants, paginationVariants, radioVariants, selectTriggerVariants, selectVariants, switchVariants, tableCellVariants, tableHeaderVariants, tableVariants, textAreaVariants, textFieldVariants, tooltipVariants, uploadBoxVariants };
5011
5073
  //# sourceMappingURL=index.esm.js.map