@bizapps/ui 1.1.1 → 1.2.2

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