@hexdspace/react 0.1.27 → 0.1.29

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.d.ts CHANGED
@@ -640,4 +640,30 @@ type Props = {
640
640
  };
641
641
  declare function Tooltip({ children, content, delayMs, side, sideOffset, maxWidthPx, preserveWhitespace, }: Props): react_jsx_runtime.JSX.Element;
642
642
 
643
- export { AuthController, AuthControllerCtx, type AuthControllerDeps, AuthControllerProvider, AuthDispatchCtx, AuthProvider, type AuthState, AuthStateCtx, Button, type ButtonProps, type CacheInstruction, ConfirmDialog, type ConfirmDialogProps, type ConfirmPayload, CustomDialog, type CustomDialogPayload, type CustomDialogProps, type CustomInstruction, DEFAULT_NOTIFICATION_CHANNEL, type DefaultDialogPayloads, type DefaultDialogTemplateKey, DefaultDialogTemplateKeys, Dialog, DialogContent, DialogController, DialogHost, type DialogInstance, type DialogOptions, type DialogProps, type DialogTemplate, type ErrorResponse, Field, type FieldProps, type GenericResponse, type HttpClient, HttpError, type HttpMethod, type HttpResponse, InfoDialog, type InfoDialogProps, type InfoPayload, Input, type InputProps, type Instruction, type InstructionContext, MockAuthHttpClient, MockHttpClient, type MutationFn, type Notification, type NotificationAction, NotificationHost, type NotificationInstruction, type NotificationVariant, NotifierController, type OnSuccessFn, type OptimisticSnapshot, type OptimisticUpdateFn, RedirectIfAuthed, type RedirectIfAuthedProps, type RequestConfig, RequireAuth, type RequireAuthProps, type ResolvedToastTheme, type ResponsiveMutation, Skeleton, type SkeletonProps, Textarea, type TextareaProps, type ToastActionTheme, type ToastTheme, type ToastTransition, type ToastifyCSSVars, Tooltip, type UIFail, type UIOk, type UIResult, type User, authController, controllerFactory, createAuthController, dialogController, httpClient as fetchHttpClient, getDialogTemplate, notifierController, registerDefaultDialogs, registerDialogTemplate, resolveToastTheme, ui, unregisterDialogTemplate, useAuth, useAuthActions, useAuthController, useAuthDispatch, useAuthedUser, useDialog, useResponsiveMutation };
643
+ declare const popoverContentVariants: (props?: ({
644
+ chrome?: "flat" | "glass" | "glow" | "hairline" | null | undefined;
645
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
646
+ interface PopoverProps extends VariantProps<typeof popoverContentVariants> {
647
+ trigger: React.ReactElement;
648
+ children: React.ReactNode;
649
+ open?: boolean;
650
+ defaultOpen?: boolean;
651
+ onOpenChange?: (open: boolean) => void;
652
+ modal?: boolean;
653
+ side?: 'top' | 'right' | 'bottom' | 'left';
654
+ align?: 'start' | 'center' | 'end';
655
+ sideOffset?: number;
656
+ alignOffset?: number;
657
+ collisionPadding?: number;
658
+ withArrow?: boolean;
659
+ arrowSizePx?: number;
660
+ arrowClassName?: string;
661
+ portalContainer?: Element | null;
662
+ ariaLabel?: string;
663
+ ariaLabelledBy?: string;
664
+ className?: string;
665
+ style?: React.CSSProperties;
666
+ }
667
+ declare function Popover({ trigger, children, open, defaultOpen, onOpenChange, modal, side, align, sideOffset, alignOffset, collisionPadding, withArrow, arrowSizePx, arrowClassName, portalContainer, ariaLabel, ariaLabelledBy, chrome, className, style, }: PopoverProps): react_jsx_runtime.JSX.Element;
668
+
669
+ export { AuthController, AuthControllerCtx, type AuthControllerDeps, AuthControllerProvider, AuthDispatchCtx, AuthProvider, type AuthState, AuthStateCtx, Button, type ButtonProps, type CacheInstruction, ConfirmDialog, type ConfirmDialogProps, type ConfirmPayload, CustomDialog, type CustomDialogPayload, type CustomDialogProps, type CustomInstruction, DEFAULT_NOTIFICATION_CHANNEL, type DefaultDialogPayloads, type DefaultDialogTemplateKey, DefaultDialogTemplateKeys, Dialog, DialogContent, DialogController, DialogHost, type DialogInstance, type DialogOptions, type DialogProps, type DialogTemplate, type ErrorResponse, Field, type FieldProps, type GenericResponse, type HttpClient, HttpError, type HttpMethod, type HttpResponse, InfoDialog, type InfoDialogProps, type InfoPayload, Input, type InputProps, type Instruction, type InstructionContext, MockAuthHttpClient, MockHttpClient, type MutationFn, type Notification, type NotificationAction, NotificationHost, type NotificationInstruction, type NotificationVariant, NotifierController, type OnSuccessFn, type OptimisticSnapshot, type OptimisticUpdateFn, Popover, type PopoverProps, RedirectIfAuthed, type RedirectIfAuthedProps, type RequestConfig, RequireAuth, type RequireAuthProps, type ResolvedToastTheme, type ResponsiveMutation, Skeleton, type SkeletonProps, Textarea, type TextareaProps, type ToastActionTheme, type ToastTheme, type ToastTransition, type ToastifyCSSVars, Tooltip, type UIFail, type UIOk, type UIResult, type User, authController, controllerFactory, createAuthController, dialogController, httpClient as fetchHttpClient, getDialogTemplate, notifierController, registerDefaultDialogs, registerDialogTemplate, resolveToastTheme, ui, unregisterDialogTemplate, useAuth, useAuthActions, useAuthController, useAuthDispatch, useAuthedUser, useDialog, useResponsiveMutation };
package/dist/index.js CHANGED
@@ -1542,8 +1542,8 @@ Button.displayName = "Button";
1542
1542
 
1543
1543
  // src/ui/components/dialog/Dialog.tsx
1544
1544
  import { cva as cva2 } from "class-variance-authority";
1545
- import { AnimatePresence, motion } from "motion/react";
1546
1545
  import { XIcon } from "lucide-react";
1546
+ import { AnimatePresence, motion } from "motion/react";
1547
1547
  import { Dialog as DialogPrimitive } from "radix-ui";
1548
1548
  import * as React3 from "react";
1549
1549
 
@@ -1743,8 +1743,16 @@ function Dialog({
1743
1743
  className: overlayClassName,
1744
1744
  style: { zIndex: zIndex - 1 },
1745
1745
  variants: {
1746
- open: { opacity: 1, pointerEvents: "auto", transition: { duration: motionDuration, ease: "easeOut" } },
1747
- closed: { opacity: 0, pointerEvents: "none", transition: { duration: motionDuration, ease: "easeOut" } }
1746
+ open: {
1747
+ opacity: 1,
1748
+ pointerEvents: "auto",
1749
+ transition: { duration: motionDuration, ease: "easeOut" }
1750
+ },
1751
+ closed: {
1752
+ opacity: 0,
1753
+ pointerEvents: "none",
1754
+ transition: { duration: motionDuration, ease: "easeOut" }
1755
+ }
1748
1756
  },
1749
1757
  initial: "closed",
1750
1758
  animate: overlayReady ? "open" : "closed",
@@ -1781,8 +1789,16 @@ function Dialog({
1781
1789
  "--dialog-width": `${maxWidthPx}px`
1782
1790
  },
1783
1791
  variants: {
1784
- open: { opacity: 1, pointerEvents: "auto", transition: { duration: motionDuration, ease: "easeOut" } },
1785
- closed: { opacity: 0, pointerEvents: "none", transition: { duration: motionDuration, ease: "easeIn" } }
1792
+ open: {
1793
+ opacity: 1,
1794
+ pointerEvents: "auto",
1795
+ transition: { duration: motionDuration, ease: "easeOut" }
1796
+ },
1797
+ closed: {
1798
+ opacity: 0,
1799
+ pointerEvents: "none",
1800
+ transition: { duration: motionDuration, ease: "easeIn" }
1801
+ }
1786
1802
  },
1787
1803
  initial: "open",
1788
1804
  animate: "open",
@@ -1792,8 +1808,16 @@ function Dialog({
1792
1808
  {
1793
1809
  className: surfaceClassName,
1794
1810
  variants: {
1795
- open: { opacity: 1, y: 0, transition: { duration: motionDuration, ease: "easeOut" } },
1796
- closed: { opacity: 0, y: 20, transition: { duration: motionDuration, ease: "easeIn" } }
1811
+ open: {
1812
+ opacity: 1,
1813
+ y: 0,
1814
+ transition: { duration: motionDuration, ease: "easeOut" }
1815
+ },
1816
+ closed: {
1817
+ opacity: 0,
1818
+ y: 20,
1819
+ transition: { duration: motionDuration, ease: "easeIn" }
1820
+ }
1797
1821
  },
1798
1822
  initial: "closed",
1799
1823
  animate: surfaceReady ? "open" : "closed",
@@ -1810,21 +1834,14 @@ function Dialog({
1810
1834
  tabIndex: -1
1811
1835
  }
1812
1836
  ) }) : null,
1813
- /* @__PURE__ */ jsx7(
1814
- AutoHeight,
1837
+ /* @__PURE__ */ jsx7(AutoHeight, { onReady: handleAutoHeightReady, durationSeconds: motionDuration, children: /* @__PURE__ */ jsx7(
1838
+ Template,
1815
1839
  {
1816
- onReady: handleAutoHeightReady,
1817
- durationSeconds: motionDuration,
1818
- children: /* @__PURE__ */ jsx7(
1819
- Template,
1820
- {
1821
- id: id ?? fallbackId,
1822
- payload,
1823
- onResolve: handleResolve
1824
- }
1825
- )
1840
+ id: id ?? fallbackId,
1841
+ payload,
1842
+ onResolve: handleResolve
1826
1843
  }
1827
- )
1844
+ ) })
1828
1845
  ]
1829
1846
  }
1830
1847
  )
@@ -2546,48 +2563,177 @@ function Tooltip({
2546
2563
  const motionDuration = useMotionDuration("--motion-fast", 0.14);
2547
2564
  return /* @__PURE__ */ jsx17(TooltipPrimitive.Provider, { delayDuration: delayMs, children: /* @__PURE__ */ jsxs9(TooltipPrimitive.Root, { onOpenChange: setOpen, children: [
2548
2565
  /* @__PURE__ */ jsx17(TooltipPrimitive.Trigger, { asChild: true, children }),
2549
- /* @__PURE__ */ jsx17(TooltipPrimitive.Portal, { forceMount: true, children: /* @__PURE__ */ jsx17(AnimatePresence2, { children: open2 ? /* @__PURE__ */ jsx17(
2550
- TooltipPrimitive.Content,
2566
+ /* @__PURE__ */ jsx17(TooltipPrimitive.Portal, { forceMount: true, children: /* @__PURE__ */ jsx17(AnimatePresence2, { children: open2 ? /* @__PURE__ */ jsx17(TooltipPrimitive.Content, { asChild: true, forceMount: true, side, sideOffset, children: /* @__PURE__ */ jsxs9(
2567
+ motion2.div,
2568
+ {
2569
+ className: tooltipContentBase,
2570
+ initial: {
2571
+ opacity: 0,
2572
+ scale: 0.98,
2573
+ x: "var(--tooltip-x)",
2574
+ y: "var(--tooltip-y)"
2575
+ },
2576
+ animate: { opacity: 1, scale: 1, x: 0, y: 0 },
2577
+ exit: {
2578
+ opacity: 0,
2579
+ scale: 0.98,
2580
+ x: "var(--tooltip-x)",
2581
+ y: "var(--tooltip-y)",
2582
+ transition: { duration: motionDuration, ease: "easeIn" }
2583
+ },
2584
+ transition: { duration: motionDuration, ease: "easeOut" },
2585
+ style: {
2586
+ width: "max-content",
2587
+ maxWidth: `min(${maxWidthPx}px, 90vw)`,
2588
+ whiteSpace: preserveWhitespace ? "pre-line" : "normal",
2589
+ overflowWrap: "break-word",
2590
+ hyphens: "auto"
2591
+ },
2592
+ children: [
2593
+ content,
2594
+ /* @__PURE__ */ jsx17(TooltipPrimitive.Arrow, { style: { fill: "var(--surface-2)" } })
2595
+ ]
2596
+ }
2597
+ ) }) : null }) })
2598
+ ] }) });
2599
+ }
2600
+
2601
+ // src/ui/components/Popover.tsx
2602
+ import { cva as cva6 } from "class-variance-authority";
2603
+ import { AnimatePresence as AnimatePresence3, motion as motion3 } from "motion/react";
2604
+ import { Popover as PopoverPrimitive } from "radix-ui";
2605
+ import * as React11 from "react";
2606
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
2607
+ var popoverContentVariants = cva6(
2608
+ cn(
2609
+ "p-3 text-sm z-5000",
2610
+ "origin-center",
2611
+ "[--popover-x:0px] [--popover-y:6px]",
2612
+ "data-[side=bottom]:[--popover-y:-6px]",
2613
+ "data-[side=left]:[--popover-x:6px] data-[side=left]:[--popover-y:0px]",
2614
+ "data-[side=right]:[--popover-x:-6px] data-[side=right]:[--popover-y:0px]"
2615
+ ),
2616
+ {
2617
+ variants: {
2618
+ chrome: {
2619
+ flat: "card",
2620
+ glass: cn(
2621
+ "border border-[color:color-mix(in_oklab,var(--border),transparent_55%)]",
2622
+ "bg-[color:color-mix(in_oklab,var(--surface-2),transparent_25%)]",
2623
+ "backdrop-blur-[6px]",
2624
+ "rounded-[var(--radius-card)]",
2625
+ "shadow-[0_12px_26px_rgba(0,0,0,0.16)]"
2626
+ ),
2627
+ glow: cn(
2628
+ "rounded-[var(--radius-card)]",
2629
+ "border border-[color:color-mix(in_oklab,var(--border),transparent_60%)]",
2630
+ "bg-[color:var(--surface-2)]",
2631
+ "shadow-[0_0_0_1px_color-mix(in_oklab,var(--border),transparent_55%),0_12px_28px_color-mix(in_oklab,var(--border),transparent_65%)]"
2632
+ ),
2633
+ hairline: cn(
2634
+ "rounded-[var(--radius-card)]",
2635
+ "border border-[color:color-mix(in_oklab,var(--border),transparent_70%)]",
2636
+ "bg-transparent",
2637
+ "shadow-none"
2638
+ )
2639
+ }
2640
+ },
2641
+ defaultVariants: {
2642
+ chrome: "flat"
2643
+ }
2644
+ }
2645
+ );
2646
+ function Popover({
2647
+ trigger,
2648
+ children,
2649
+ open: open2,
2650
+ defaultOpen,
2651
+ onOpenChange,
2652
+ modal = false,
2653
+ side = "bottom",
2654
+ align = "end",
2655
+ sideOffset = 8,
2656
+ alignOffset = 8,
2657
+ collisionPadding = 8,
2658
+ withArrow = false,
2659
+ arrowSizePx = 10,
2660
+ arrowClassName,
2661
+ portalContainer,
2662
+ ariaLabel = "Popover",
2663
+ ariaLabelledBy,
2664
+ chrome,
2665
+ className,
2666
+ style
2667
+ }) {
2668
+ const [uncontrolledOpen, setUncontrolledOpen] = React11.useState(defaultOpen ?? false);
2669
+ const isControlled = open2 !== void 0;
2670
+ const resolvedOpen = isControlled ? open2 : uncontrolledOpen;
2671
+ const contentId = React11.useId();
2672
+ const motionDuration = useMotionDuration("--motion-fast", 0.14);
2673
+ const handleOpenChange = (nextOpen) => {
2674
+ if (!isControlled) setUncontrolledOpen(nextOpen);
2675
+ onOpenChange?.(nextOpen);
2676
+ };
2677
+ return /* @__PURE__ */ jsxs10(PopoverPrimitive.Root, { open: resolvedOpen, onOpenChange: handleOpenChange, modal, children: [
2678
+ /* @__PURE__ */ jsx18(
2679
+ PopoverPrimitive.Trigger,
2680
+ {
2681
+ asChild: true,
2682
+ "aria-controls": resolvedOpen ? contentId : void 0,
2683
+ "aria-expanded": resolvedOpen,
2684
+ children: trigger
2685
+ }
2686
+ ),
2687
+ /* @__PURE__ */ jsx18(PopoverPrimitive.Portal, { forceMount: true, container: portalContainer, children: /* @__PURE__ */ jsx18(AnimatePresence3, { children: resolvedOpen ? /* @__PURE__ */ jsx18(
2688
+ PopoverPrimitive.Content,
2551
2689
  {
2552
2690
  asChild: true,
2553
2691
  forceMount: true,
2692
+ id: contentId,
2554
2693
  side,
2694
+ align,
2555
2695
  sideOffset,
2556
- children: /* @__PURE__ */ jsxs9(
2557
- motion2.div,
2696
+ alignOffset,
2697
+ collisionPadding,
2698
+ "aria-label": ariaLabelledBy ? void 0 : ariaLabel,
2699
+ "aria-labelledby": ariaLabelledBy,
2700
+ children: /* @__PURE__ */ jsxs10(
2701
+ motion3.div,
2558
2702
  {
2559
- className: tooltipContentBase,
2703
+ className: cn(popoverContentVariants({ chrome }), className),
2560
2704
  initial: {
2561
2705
  opacity: 0,
2562
2706
  scale: 0.98,
2563
- x: "var(--tooltip-x)",
2564
- y: "var(--tooltip-y)"
2707
+ x: "var(--popover-x)",
2708
+ y: "var(--popover-y)"
2565
2709
  },
2566
2710
  animate: { opacity: 1, scale: 1, x: 0, y: 0 },
2567
2711
  exit: {
2568
2712
  opacity: 0,
2569
2713
  scale: 0.98,
2570
- x: "var(--tooltip-x)",
2571
- y: "var(--tooltip-y)",
2714
+ x: "var(--popover-x)",
2715
+ y: "var(--popover-y)",
2572
2716
  transition: { duration: motionDuration, ease: "easeIn" }
2573
2717
  },
2574
2718
  transition: { duration: motionDuration, ease: "easeOut" },
2575
- style: {
2576
- width: "max-content",
2577
- maxWidth: `min(${maxWidthPx}px, 90vw)`,
2578
- whiteSpace: preserveWhitespace ? "pre-line" : "normal",
2579
- overflowWrap: "break-word",
2580
- hyphens: "auto"
2581
- },
2719
+ style,
2582
2720
  children: [
2583
- content,
2584
- /* @__PURE__ */ jsx17(TooltipPrimitive.Arrow, { style: { fill: "var(--surface-2)" } })
2721
+ children,
2722
+ withArrow ? /* @__PURE__ */ jsx18(
2723
+ PopoverPrimitive.Arrow,
2724
+ {
2725
+ className: arrowClassName,
2726
+ width: arrowSizePx,
2727
+ height: arrowSizePx,
2728
+ style: { fill: "var(--surface-2)" }
2729
+ }
2730
+ ) : null
2585
2731
  ]
2586
2732
  }
2587
2733
  )
2588
2734
  }
2589
2735
  ) : null }) })
2590
- ] }) });
2736
+ ] });
2591
2737
  }
2592
2738
  export {
2593
2739
  AuthController,
@@ -2613,6 +2759,7 @@ export {
2613
2759
  MockHttpClient,
2614
2760
  NotificationHost,
2615
2761
  NotifierController,
2762
+ Popover,
2616
2763
  RedirectIfAuthed,
2617
2764
  RequireAuth,
2618
2765
  Skeleton,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",