@bizapps/ui 1.1.1 → 1.2.3

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/main.cjs CHANGED
@@ -1433,7 +1433,7 @@ var progressVariants = classVarianceAuthority.cva("relative flex w-full items-ce
1433
1433
  size: "md"
1434
1434
  }
1435
1435
  });
1436
- var progressIndicatorVariants = classVarianceAuthority.cva("size-full flex-1 transition-all", {
1436
+ var progressIndicatorVariants = classVarianceAuthority.cva("size-full flex-1 transition-all rounded-[5px]", {
1437
1437
  variants: {
1438
1438
  variant: {
1439
1439
  default: "bg-[var(--color-main-blue-primary)]",
@@ -1598,7 +1598,8 @@ var ease = {
1598
1598
  smooth: [0.4, 0, 0.2, 1],
1599
1599
  enter: [0, 0, 0.2, 1],
1600
1600
  exit: [0.4, 0, 1, 1],
1601
- linear: [0, 0, 1, 1]
1601
+ linear: [0, 0, 1, 1],
1602
+ drawer: [0.22, 1, 0.36, 1]
1602
1603
  };
1603
1604
  var spring = {
1604
1605
  gentle: { type: "spring", stiffness: 260, damping: 28 },
@@ -1642,6 +1643,15 @@ var transition = {
1642
1643
  card: {
1643
1644
  duration: duration.fast,
1644
1645
  ease: ease.smooth
1646
+ },
1647
+ // Drawer / slide panel — smooth enter, fast exit
1648
+ drawer: {
1649
+ duration: 0.3,
1650
+ ease: ease.drawer
1651
+ },
1652
+ drawerExit: {
1653
+ duration: 0.2,
1654
+ ease: ease.exit
1645
1655
  }
1646
1656
  };
1647
1657
  var fadeIn = {
@@ -8364,6 +8374,229 @@ function DataTableSearch({
8364
8374
  )
8365
8375
  ] });
8366
8376
  }
8377
+ var DrawerContext = react.createContext({ isOpen: false, modal: true });
8378
+ function Drawer({ children, open, onOpenChange, modal = true, ...props }) {
8379
+ const [internalOpen, setInternalOpen] = react.useState(props.defaultOpen ?? false);
8380
+ const isOpen = open !== void 0 ? open : internalOpen;
8381
+ return /* @__PURE__ */ jsxRuntime.jsx(DrawerContext.Provider, { value: { isOpen, modal }, children: /* @__PURE__ */ jsxRuntime.jsx(
8382
+ radixUi.Dialog.Root,
8383
+ {
8384
+ "data-slot": "drawer",
8385
+ modal,
8386
+ ...props,
8387
+ open: isOpen,
8388
+ onOpenChange: (v) => {
8389
+ setInternalOpen(v);
8390
+ onOpenChange?.(v);
8391
+ },
8392
+ children
8393
+ }
8394
+ ) });
8395
+ }
8396
+ function DrawerTrigger({ ...props }) {
8397
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Trigger, { "data-slot": "drawer-trigger", ...props });
8398
+ }
8399
+ function DrawerClose({ ...props }) {
8400
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Close, { "data-slot": "drawer-close", ...props });
8401
+ }
8402
+ function DrawerPortal({ children, ...props }) {
8403
+ const { isOpen } = react.useContext(DrawerContext);
8404
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Portal, { forceMount: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsx(react$1.AnimatePresence, { mode: "sync", children: isOpen && children }) });
8405
+ }
8406
+ function DrawerOverlay({ className, ...props }) {
8407
+ return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Overlay, { "data-slot": "drawer-overlay", asChild: true, forceMount: true, ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
8408
+ react$1.motion.div,
8409
+ {
8410
+ className: cn(
8411
+ "fixed inset-0 isolate z-50 bg-black/30 supports-backdrop-filter:backdrop-blur-sm",
8412
+ className
8413
+ ),
8414
+ initial: { opacity: 0 },
8415
+ animate: { opacity: 1 },
8416
+ exit: { opacity: 0 },
8417
+ transition: { duration: duration.normal, ease: ease.smooth }
8418
+ }
8419
+ ) });
8420
+ }
8421
+ var sizeClasses = {
8422
+ sm: "w-64",
8423
+ md: "w-80",
8424
+ lg: "w-96",
8425
+ xl: "w-[30rem]",
8426
+ full: "w-screen"
8427
+ };
8428
+ function DrawerContent({
8429
+ className,
8430
+ children,
8431
+ side = "right",
8432
+ size = "md",
8433
+ showCloseButton = true,
8434
+ resizable = false,
8435
+ ...props
8436
+ }) {
8437
+ const isHorizontal = side === "left" || side === "right";
8438
+ const xInitial = side === "right" ? "100%" : side === "left" ? "-100%" : 0;
8439
+ const yInitial = side === "bottom" ? "100%" : side === "top" ? "-100%" : 0;
8440
+ const dragRef = react.useRef(null);
8441
+ const { modal } = react.useContext(DrawerContext);
8442
+ return /* @__PURE__ */ jsxRuntime.jsxs(DrawerPortal, { children: [
8443
+ modal && /* @__PURE__ */ jsxRuntime.jsx(DrawerOverlay, {}),
8444
+ /* @__PURE__ */ jsxRuntime.jsx(
8445
+ radixUi.Dialog.Content,
8446
+ {
8447
+ "data-slot": "drawer-content",
8448
+ "data-side": side,
8449
+ asChild: true,
8450
+ forceMount: true,
8451
+ className: cn(
8452
+ "fixed z-50 flex flex-col bg-popover text-popover-foreground shadow-xl outline-none",
8453
+ side === "left" && "inset-y-0 left-0",
8454
+ side === "right" && "inset-y-0 right-0",
8455
+ side === "top" && "inset-x-0 top-0",
8456
+ side === "bottom" && "inset-x-0 bottom-0",
8457
+ isHorizontal && sizeClasses[size],
8458
+ !isHorizontal && "h-auto min-h-40",
8459
+ className
8460
+ ),
8461
+ ...props,
8462
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
8463
+ react$1.motion.div,
8464
+ {
8465
+ className: cn("flex flex-col", isHorizontal && "h-full"),
8466
+ initial: { x: xInitial, y: yInitial, opacity: 0 },
8467
+ animate: { x: 0, y: 0, opacity: 1, transition: transition.drawer },
8468
+ exit: { x: xInitial, y: yInitial, opacity: 0, transition: transition.drawerExit },
8469
+ children: [
8470
+ children,
8471
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(radixUi.Dialog.Close, { "data-slot": "drawer-close", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
8472
+ Button,
8473
+ {
8474
+ variant: "ghost",
8475
+ className: "absolute top-4 right-4",
8476
+ size: "icon-sm",
8477
+ children: [
8478
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
8479
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
8480
+ ]
8481
+ }
8482
+ ) }),
8483
+ resizable && /* @__PURE__ */ jsxRuntime.jsx(
8484
+ "div",
8485
+ {
8486
+ "data-slot": "drawer-resize-handle",
8487
+ className: cn(
8488
+ "absolute opacity-0 transition-opacity hover:opacity-100 hover:bg-border",
8489
+ side === "right" && "inset-y-0 left-0 w-1 cursor-col-resize",
8490
+ side === "left" && "inset-y-0 right-0 w-1 cursor-col-resize",
8491
+ side === "top" && "inset-x-0 bottom-0 h-1 cursor-row-resize",
8492
+ side === "bottom" && "inset-x-0 top-0 h-1 cursor-row-resize"
8493
+ ),
8494
+ onPointerDown: (e) => {
8495
+ e.preventDefault();
8496
+ const content = e.currentTarget.parentElement;
8497
+ if (!content) return;
8498
+ const startSize = isHorizontal ? parseFloat(getComputedStyle(content).width) : parseFloat(getComputedStyle(content).height);
8499
+ content.style.transition = "none";
8500
+ dragRef.current = {
8501
+ startPos: isHorizontal ? e.clientX : e.clientY,
8502
+ startSize,
8503
+ content
8504
+ };
8505
+ e.currentTarget.setPointerCapture(e.pointerId);
8506
+ },
8507
+ onPointerMove: (e) => {
8508
+ if (!dragRef.current) return;
8509
+ const { startPos, startSize, content } = dragRef.current;
8510
+ const delta = (isHorizontal ? e.clientX : e.clientY) - startPos;
8511
+ let newSize;
8512
+ if (side === "right") {
8513
+ newSize = Math.max(160, Math.min(window.innerWidth * 0.9, startSize - delta));
8514
+ } else if (side === "left") {
8515
+ newSize = Math.max(160, Math.min(window.innerWidth * 0.9, startSize + delta));
8516
+ } else if (side === "bottom") {
8517
+ newSize = Math.max(80, Math.min(window.innerHeight * 0.9, startSize - delta));
8518
+ } else {
8519
+ newSize = Math.max(80, Math.min(window.innerHeight * 0.9, startSize + delta));
8520
+ }
8521
+ content.style[isHorizontal ? "width" : "height"] = `${newSize}px`;
8522
+ },
8523
+ onPointerUp: () => {
8524
+ if (dragRef.current?.content) {
8525
+ dragRef.current.content.style.transition = "";
8526
+ }
8527
+ dragRef.current = null;
8528
+ },
8529
+ onPointerCancel: () => {
8530
+ if (dragRef.current?.content) {
8531
+ dragRef.current.content.style.transition = "";
8532
+ }
8533
+ dragRef.current = null;
8534
+ }
8535
+ }
8536
+ )
8537
+ ]
8538
+ }
8539
+ )
8540
+ }
8541
+ )
8542
+ ] });
8543
+ }
8544
+ function DrawerHeader({ className, ...props }) {
8545
+ return /* @__PURE__ */ jsxRuntime.jsx(
8546
+ "div",
8547
+ {
8548
+ "data-slot": "drawer-header",
8549
+ className: cn("flex shrink-0 flex-col gap-1.5 p-6", className),
8550
+ ...props
8551
+ }
8552
+ );
8553
+ }
8554
+ function DrawerBody({ className, ...props }) {
8555
+ return /* @__PURE__ */ jsxRuntime.jsx(
8556
+ "div",
8557
+ {
8558
+ "data-slot": "drawer-body",
8559
+ className: cn("flex-1 overflow-y-auto px-6 pb-6", className),
8560
+ ...props
8561
+ }
8562
+ );
8563
+ }
8564
+ function DrawerFooter({ className, ...props }) {
8565
+ return /* @__PURE__ */ jsxRuntime.jsx(
8566
+ "div",
8567
+ {
8568
+ "data-slot": "drawer-footer",
8569
+ className: cn(
8570
+ "border-border mt-auto flex shrink-0 flex-wrap items-center justify-end gap-2 border-t px-6 py-4",
8571
+ className
8572
+ ),
8573
+ ...props
8574
+ }
8575
+ );
8576
+ }
8577
+ function DrawerTitle({ className, ...props }) {
8578
+ return /* @__PURE__ */ jsxRuntime.jsx(
8579
+ radixUi.Dialog.Title,
8580
+ {
8581
+ "data-slot": "drawer-title",
8582
+ className: cn("font-heading text-base leading-none font-semibold", className),
8583
+ ...props
8584
+ }
8585
+ );
8586
+ }
8587
+ function DrawerDescription({
8588
+ className,
8589
+ ...props
8590
+ }) {
8591
+ return /* @__PURE__ */ jsxRuntime.jsx(
8592
+ radixUi.Dialog.Description,
8593
+ {
8594
+ "data-slot": "drawer-description",
8595
+ className: cn("text-sm text-muted-foreground", className),
8596
+ ...props
8597
+ }
8598
+ );
8599
+ }
8367
8600
  function TCCEProvider({
8368
8601
  children,
8369
8602
  permissions,
@@ -8466,6 +8699,17 @@ exports.DialogOverlay = DialogOverlay;
8466
8699
  exports.DialogPortal = DialogPortal;
8467
8700
  exports.DialogTitle = DialogTitle;
8468
8701
  exports.DialogTrigger = DialogTrigger;
8702
+ exports.Drawer = Drawer;
8703
+ exports.DrawerBody = DrawerBody;
8704
+ exports.DrawerClose = DrawerClose;
8705
+ exports.DrawerContent = DrawerContent;
8706
+ exports.DrawerDescription = DrawerDescription;
8707
+ exports.DrawerFooter = DrawerFooter;
8708
+ exports.DrawerHeader = DrawerHeader;
8709
+ exports.DrawerOverlay = DrawerOverlay;
8710
+ exports.DrawerPortal = DrawerPortal;
8711
+ exports.DrawerTitle = DrawerTitle;
8712
+ exports.DrawerTrigger = DrawerTrigger;
8469
8713
  exports.DropdownMenu = DropdownMenu;
8470
8714
  exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
8471
8715
  exports.DropdownMenuContent = DropdownMenuContent;