infinity-ui-elements 1.9.15 → 1.9.16

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.js CHANGED
@@ -1338,6 +1338,183 @@ const Badge = React__namespace.forwardRef(({ className, variant, size, color, sh
1338
1338
  });
1339
1339
  Badge.displayName = "Badge";
1340
1340
 
1341
+ const dividerVariants = classVarianceAuthority.cva("", {
1342
+ variants: {
1343
+ orientation: {
1344
+ horizontal: "w-full",
1345
+ vertical: "h-full",
1346
+ },
1347
+ thickness: {
1348
+ thinner: "",
1349
+ thin: "",
1350
+ thick: "",
1351
+ thicker: "",
1352
+ },
1353
+ lineStyle: {
1354
+ solid: "border-solid",
1355
+ dashed: "border-dashed",
1356
+ },
1357
+ variant: {
1358
+ normal: "",
1359
+ subtle: "",
1360
+ muted: "",
1361
+ },
1362
+ },
1363
+ compoundVariants: [
1364
+ // Horizontal orientation with thickness
1365
+ {
1366
+ orientation: "horizontal",
1367
+ thickness: "thinner",
1368
+ class: "border-t-[0.5px]",
1369
+ },
1370
+ {
1371
+ orientation: "horizontal",
1372
+ thickness: "thin",
1373
+ class: "border-t-[1px]",
1374
+ },
1375
+ {
1376
+ orientation: "horizontal",
1377
+ thickness: "thick",
1378
+ class: "border-t-[2px]",
1379
+ },
1380
+ {
1381
+ orientation: "horizontal",
1382
+ thickness: "thicker",
1383
+ class: "border-t-[3px]",
1384
+ },
1385
+ // Vertical orientation with thickness
1386
+ {
1387
+ orientation: "vertical",
1388
+ thickness: "thinner",
1389
+ class: "border-l-[0.5px]",
1390
+ },
1391
+ {
1392
+ orientation: "vertical",
1393
+ thickness: "thin",
1394
+ class: "border-l-[1px]",
1395
+ },
1396
+ {
1397
+ orientation: "vertical",
1398
+ thickness: "thick",
1399
+ class: "border-l-[2px]",
1400
+ },
1401
+ {
1402
+ orientation: "vertical",
1403
+ thickness: "thicker",
1404
+ class: "border-l-[3px]",
1405
+ },
1406
+ // Normal variant colors
1407
+ {
1408
+ variant: "normal",
1409
+ class: "border-surface-outline-neutral-normal",
1410
+ },
1411
+ // Subtle variant colors
1412
+ {
1413
+ variant: "subtle",
1414
+ class: "border-surface-outline-neutral-subtle",
1415
+ },
1416
+ // Muted variant colors
1417
+ {
1418
+ variant: "muted",
1419
+ class: "border-surface-outline-neutral-muted",
1420
+ },
1421
+ ],
1422
+ defaultVariants: {
1423
+ orientation: "horizontal",
1424
+ thickness: "thin",
1425
+ lineStyle: "solid",
1426
+ variant: "normal",
1427
+ },
1428
+ });
1429
+ const Divider = React__namespace.forwardRef(({ className, orientation = "horizontal", thickness = "thin", lineStyle = "solid", variant = "normal", ...props }, ref) => {
1430
+ return (jsxRuntime.jsx("div", { ref: ref, role: "separator", "aria-orientation": orientation, className: cn(dividerVariants({ orientation, thickness, lineStyle, variant }), className), ...props }));
1431
+ });
1432
+ Divider.displayName = "Divider";
1433
+
1434
+ const BottomSheet = React__namespace.forwardRef(({ isOpen, onClose, title, description, footer, children, variant = "default", showCloseButton = true, showDragHandle = true, closeOnOverlayClick = true, closeOnEscape = true, closeOnSwipeDown = true, maxHeight = "90vh", className, contentClassName, headerClassName, bodyClassName, footerClassName, overlayClassName, ariaLabel, ariaDescribedBy, }, ref) => {
1435
+ const sheetRef = React__namespace.useRef(null);
1436
+ const contentRef = ref || sheetRef;
1437
+ const [isClosing, setIsClosing] = React__namespace.useState(false);
1438
+ const [touchStart, setTouchStart] = React__namespace.useState(null);
1439
+ const [touchEnd, setTouchEnd] = React__namespace.useState(null);
1440
+ // Handle escape key
1441
+ React__namespace.useEffect(() => {
1442
+ if (!isOpen || !closeOnEscape || !onClose)
1443
+ return;
1444
+ const handleEscape = (e) => {
1445
+ if (e.key === "Escape") {
1446
+ handleClose();
1447
+ }
1448
+ };
1449
+ document.addEventListener("keydown", handleEscape);
1450
+ return () => document.removeEventListener("keydown", handleEscape);
1451
+ }, [isOpen, closeOnEscape, onClose]);
1452
+ // Prevent body scroll when bottom sheet is open
1453
+ React__namespace.useEffect(() => {
1454
+ if (isOpen) {
1455
+ document.body.style.overflow = "hidden";
1456
+ }
1457
+ else {
1458
+ document.body.style.overflow = "";
1459
+ }
1460
+ return () => {
1461
+ document.body.style.overflow = "";
1462
+ };
1463
+ }, [isOpen]);
1464
+ // Reset closing state when opening
1465
+ React__namespace.useEffect(() => {
1466
+ if (isOpen) {
1467
+ setIsClosing(false);
1468
+ }
1469
+ }, [isOpen]);
1470
+ // Handle close with animation
1471
+ const handleClose = () => {
1472
+ if (!onClose)
1473
+ return;
1474
+ setIsClosing(true);
1475
+ // Wait for animation to complete before calling onClose
1476
+ setTimeout(() => {
1477
+ onClose();
1478
+ setIsClosing(false);
1479
+ }, 300); // Match animation duration
1480
+ };
1481
+ // Handle overlay click
1482
+ const handleOverlayClick = (e) => {
1483
+ if (closeOnOverlayClick && e.target === e.currentTarget) {
1484
+ handleClose();
1485
+ }
1486
+ };
1487
+ // Handle touch events for swipe down
1488
+ const handleTouchStart = (e) => {
1489
+ if (!closeOnSwipeDown)
1490
+ return;
1491
+ setTouchEnd(null);
1492
+ setTouchStart(e.targetTouches[0].clientY);
1493
+ };
1494
+ const handleTouchMove = (e) => {
1495
+ if (!closeOnSwipeDown)
1496
+ return;
1497
+ setTouchEnd(e.targetTouches[0].clientY);
1498
+ };
1499
+ const handleTouchEnd = () => {
1500
+ if (!closeOnSwipeDown || !touchStart || !touchEnd)
1501
+ return;
1502
+ const distance = touchEnd - touchStart;
1503
+ const isSwipeDown = distance > 100; // Minimum swipe distance
1504
+ if (isSwipeDown) {
1505
+ handleClose();
1506
+ }
1507
+ setTouchStart(null);
1508
+ setTouchEnd(null);
1509
+ };
1510
+ // Don't render if not open and not closing
1511
+ if (!isOpen && !isClosing)
1512
+ return null;
1513
+ const hasHeader = title || description;
1514
+ return (jsxRuntime.jsxs("div", { className: cn("fixed inset-0 z-9999 flex items-end justify-center", 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 duration-300", isClosing ? "opacity-0" : "opacity-100", overlayClassName), onClick: handleOverlayClick, "aria-hidden": "true" }), jsxRuntime.jsxs("div", { ref: contentRef, className: cn("relative z-10 w-full transition-transform duration-300", "flex flex-col overflow-hidden", variant === "default" && "bg-white rounded-t-2xl shadow-xl", isClosing ? "animate-slide-out-bottom" : "animate-slide-in-bottom", contentClassName), style: { maxHeight }, onTouchStart: handleTouchStart, onTouchMove: handleTouchMove, onTouchEnd: handleTouchEnd, children: [showDragHandle && variant === "default" && (jsxRuntime.jsx("div", { className: "flex justify-center pt-3 pb-2", children: jsxRuntime.jsx("div", { className: "w-10 h-1 bg-neutral-300 rounded-full" }) })), hasHeader && (jsxRuntime.jsxs("div", { className: cn("flex items-start justify-between gap-4", variant === "default" && "px-6", variant === "default" && !showDragHandle && "pt-6", variant === "default" && showDragHandle && "pt-2", variant === "default" && !description && "pb-4", variant === "default" && 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: handleClose, color: "neutral", size: "small", "aria-label": "Close bottom sheet", className: "shrink-0" }))] })), !hasHeader && showCloseButton && onClose && (jsxRuntime.jsx("div", { className: cn("absolute z-10", variant === "default" && "top-4 right-4"), children: jsxRuntime.jsx(IconButton, { icon: "close", onClick: handleClose, color: "neutral", size: "small", "aria-label": "Close bottom sheet" }) })), jsxRuntime.jsx("div", { className: cn("flex-1 overflow-y-auto", variant === "default" && "px-6", variant === "default" && hasHeader && "py-4", variant === "default" && !hasHeader && !showDragHandle && "pt-6 pb-4", variant === "default" && !hasHeader && showDragHandle && "pt-2 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", variant === "default" && "px-6 py-4", footerClassName), children: footer })] }))] })] }));
1515
+ });
1516
+ BottomSheet.displayName = "BottomSheet";
1517
+
1341
1518
  const buttonGroupVariants = classVarianceAuthority.cva("inline-flex", {
1342
1519
  variants: {
1343
1520
  variant: {
@@ -2961,99 +3138,6 @@ const DateRangePicker = React__namespace.forwardRef(({ className, value: control
2961
3138
  });
2962
3139
  DateRangePicker.displayName = "DateRangePicker";
2963
3140
 
2964
- const dividerVariants = classVarianceAuthority.cva("", {
2965
- variants: {
2966
- orientation: {
2967
- horizontal: "w-full",
2968
- vertical: "h-full",
2969
- },
2970
- thickness: {
2971
- thinner: "",
2972
- thin: "",
2973
- thick: "",
2974
- thicker: "",
2975
- },
2976
- lineStyle: {
2977
- solid: "border-solid",
2978
- dashed: "border-dashed",
2979
- },
2980
- variant: {
2981
- normal: "",
2982
- subtle: "",
2983
- muted: "",
2984
- },
2985
- },
2986
- compoundVariants: [
2987
- // Horizontal orientation with thickness
2988
- {
2989
- orientation: "horizontal",
2990
- thickness: "thinner",
2991
- class: "border-t-[0.5px]",
2992
- },
2993
- {
2994
- orientation: "horizontal",
2995
- thickness: "thin",
2996
- class: "border-t-[1px]",
2997
- },
2998
- {
2999
- orientation: "horizontal",
3000
- thickness: "thick",
3001
- class: "border-t-[2px]",
3002
- },
3003
- {
3004
- orientation: "horizontal",
3005
- thickness: "thicker",
3006
- class: "border-t-[3px]",
3007
- },
3008
- // Vertical orientation with thickness
3009
- {
3010
- orientation: "vertical",
3011
- thickness: "thinner",
3012
- class: "border-l-[0.5px]",
3013
- },
3014
- {
3015
- orientation: "vertical",
3016
- thickness: "thin",
3017
- class: "border-l-[1px]",
3018
- },
3019
- {
3020
- orientation: "vertical",
3021
- thickness: "thick",
3022
- class: "border-l-[2px]",
3023
- },
3024
- {
3025
- orientation: "vertical",
3026
- thickness: "thicker",
3027
- class: "border-l-[3px]",
3028
- },
3029
- // Normal variant colors
3030
- {
3031
- variant: "normal",
3032
- class: "border-surface-outline-neutral-normal",
3033
- },
3034
- // Subtle variant colors
3035
- {
3036
- variant: "subtle",
3037
- class: "border-surface-outline-neutral-subtle",
3038
- },
3039
- // Muted variant colors
3040
- {
3041
- variant: "muted",
3042
- class: "border-surface-outline-neutral-muted",
3043
- },
3044
- ],
3045
- defaultVariants: {
3046
- orientation: "horizontal",
3047
- thickness: "thin",
3048
- lineStyle: "solid",
3049
- variant: "normal",
3050
- },
3051
- });
3052
- const Divider = React__namespace.forwardRef(({ className, orientation = "horizontal", thickness = "thin", lineStyle = "solid", variant = "normal", ...props }, ref) => {
3053
- return (jsxRuntime.jsx("div", { ref: ref, role: "separator", "aria-orientation": orientation, className: cn(dividerVariants({ orientation, thickness, lineStyle, variant }), className), ...props }));
3054
- });
3055
- Divider.displayName = "Divider";
3056
-
3057
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) => {
3058
3142
  const renderContent = () => {
3059
3143
  if (isLoading) {
@@ -5974,6 +6058,7 @@ exports.Amount = Amount;
5974
6058
  exports.Avatar = Avatar;
5975
6059
  exports.AvatarCell = AvatarCell;
5976
6060
  exports.Badge = Badge;
6061
+ exports.BottomSheet = BottomSheet;
5977
6062
  exports.Button = Button;
5978
6063
  exports.ButtonGroup = ButtonGroup;
5979
6064
  exports.Checkbox = Checkbox;