@stackframe/stack-ui 2.5.13 → 2.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @stackframe/stack-ui
2
2
 
3
+ ## 2.5.16
4
+
5
+ ### Patch Changes
6
+
7
+ - @stackframe/stack-shared@2.5.16
8
+
9
+ ## 2.5.15
10
+
11
+ ### Patch Changes
12
+
13
+ - Webhooks
14
+ - Updated dependencies
15
+ - @stackframe/stack-shared@2.5.15
16
+
17
+ ## 2.5.14
18
+
19
+ ### Patch Changes
20
+
21
+ - @stackframe/stack-shared@2.5.14
22
+
3
23
  ## 2.5.13
4
24
 
5
25
  ### Patch Changes
@@ -0,0 +1,26 @@
1
+ import { Button } from '..';
2
+ import { LucideIcon } from "lucide-react";
3
+ import React from "react";
4
+ export type ActionDialogProps = {
5
+ trigger?: React.ReactNode;
6
+ open?: boolean;
7
+ onClose?: () => void;
8
+ onOpenChange?: (open: boolean) => void;
9
+ titleIcon?: LucideIcon;
10
+ title: boolean | React.ReactNode;
11
+ description?: React.ReactNode;
12
+ danger?: boolean;
13
+ okButton?: boolean | Readonly<{
14
+ label?: string;
15
+ onClick?: () => Promise<"prevent-close" | undefined | void>;
16
+ props?: Partial<React.ComponentProps<typeof Button>>;
17
+ }>;
18
+ cancelButton?: boolean | Readonly<{
19
+ label?: string;
20
+ onClick?: () => Promise<"prevent-close" | undefined | void>;
21
+ props?: Partial<React.ComponentProps<typeof Button>>;
22
+ }>;
23
+ confirmText?: string;
24
+ children?: React.ReactNode;
25
+ };
26
+ export declare function ActionDialog(props: ActionDialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Alert, Button, Checkbox, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Label } from '..';
4
+ import { CircleAlert, Info } from "lucide-react";
5
+ import React, { useId } from "react";
6
+ export function ActionDialog(props) {
7
+ const okButton = props.okButton === true ? {} : props.okButton;
8
+ const cancelButton = props.cancelButton === true ? {} : props.cancelButton;
9
+ const anyButton = !!(okButton || cancelButton);
10
+ const title = props.title === true ? (props.cancelButton ? "Confirmation" : "Alert") : props.title;
11
+ const TitleIcon = props.titleIcon || (props.danger ? CircleAlert : Info);
12
+ const [openState, setOpenState] = React.useState(!!props.open);
13
+ const open = props.open ?? openState;
14
+ const [confirmed, setConfirmed] = React.useState(false);
15
+ const confirmId = useId();
16
+ const [invalidationCount, setInvalidationCount] = React.useState(0);
17
+ const onOpenChange = (open) => {
18
+ if (!open) {
19
+ props.onClose?.();
20
+ setConfirmed(false);
21
+ }
22
+ else {
23
+ setInvalidationCount(invalidationCount + 1);
24
+ }
25
+ setOpenState(open);
26
+ props.onOpenChange?.(open);
27
+ };
28
+ return (_jsxs(Dialog, { open: open, onOpenChange: onOpenChange, children: [props.trigger && _jsx(DialogTrigger, { asChild: true, children: props.trigger }), _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsxs(DialogTitle, { className: "flex items-center", children: [_jsx(TitleIcon, { className: "h-4 w-4 mr-2" }), title] }), _jsx(DialogDescription, { children: props.description })] }), _jsxs(DialogBody, { className: "pb-2", children: [_jsx("div", { children: props.children }), props.confirmText && _jsx(Alert, { children: _jsxs(Label, { className: "flex gap-4 items-center", children: [_jsx(Checkbox, { id: confirmId, checked: confirmed, onCheckedChange: (v) => setConfirmed(!!v) }), props.confirmText] }) })] }), anyButton && _jsxs(DialogFooter, { className: "gap-2", children: [cancelButton && (_jsx(Button, { variant: "secondary", color: "neutral", onClick: async () => {
29
+ if (await cancelButton.onClick?.() !== "prevent-close") {
30
+ onOpenChange(false);
31
+ }
32
+ }, ...cancelButton.props, children: "Cancel" })), okButton && (_jsx(Button, { disabled: !!props.confirmText && !confirmed, variant: props.danger ? "destructive" : "default", onClick: async () => {
33
+ if (await okButton.onClick?.() !== "prevent-close") {
34
+ onOpenChange(false);
35
+ }
36
+ }, ...okButton.props, children: okButton.label ?? "OK" }))] })] })] }, invalidationCount));
37
+ }
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ export type Props = {
3
+ url?: string;
4
+ padding?: string;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare const BrowserFrame: ({ url, padding, children }: Props) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const BrowserFrame = ({ url, padding, children }) => (_jsxs("div", { className: "rounded-xl overflow-hidden shadow-2xl", children: [_jsxs("div", { className: "bg-gray-200 dark:bg-gray-800 h-10 flex items-center py-2 px-4 box-border", children: [_jsx("div", { className: "w-3 h-3 bg-red-500 rounded-full mr-1.5 flex-shrink-0" }), _jsx("div", { className: "w-3 h-3 bg-yellow-500 rounded-full mr-1.5 flex-shrink-0" }), _jsx("div", { className: "w-3 h-3 bg-green-500 rounded-full mr-2 flex-shrink-0" }), url && (_jsx("div", { className: "text-left bg-white dark:bg-gray-700 h-6 rounded-full leading-6 text-sm text-gray-700 dark:text-gray-300 flex-grow ml-2 mr-4 px-4 whitespace-nowrap overflow-hidden overflow-ellipsis", "aria-hidden": true, children: url })), _jsxs("div", { className: "w-4 h-4 ml-auto flex flex-col justify-evenly items-stretch flex-shrink-0", children: [_jsx("span", { className: "h-0.5 bg-gray-400 dark:bg-gray-500" }), _jsx("span", { className: "h-0.5 bg-gray-400 dark:bg-gray-500" }), _jsx("span", { className: "h-0.5 bg-gray-400 dark:bg-gray-500" })] })] }), _jsx("div", { className: `flex flex-col p-4 bg-white dark:bg-black rounded-b-md ${padding ? padding : ""}`, children: children })] }));
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ declare const CopyButton: React.ForwardRefExoticComponent<Omit<import("./ui/button").ButtonProps & React.RefAttributes<HTMLButtonElement> & {
3
+ content: string;
4
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
+ export { CopyButton };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Copy } from "lucide-react";
4
+ import React from "react";
5
+ import { Button, cn, useToast } from "..";
6
+ const CopyButton = React.forwardRef((props, ref) => {
7
+ const { toast } = useToast();
8
+ return (_jsx(Button, { variant: "secondary", ...props, className: cn("h-6 w-6 p-1", props.className), ref: ref, onClick: async (...args) => {
9
+ await props.onClick?.(...args);
10
+ try {
11
+ await navigator.clipboard.writeText(props.content);
12
+ toast({ description: 'Copied to clipboard!' });
13
+ }
14
+ catch (e) {
15
+ toast({ description: 'Failed to copy to clipboard', variant: 'destructive' });
16
+ }
17
+ }, children: _jsx(Copy, {}) }));
18
+ });
19
+ CopyButton.displayName = "CopyButton";
20
+ export { CopyButton };
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare function CopyField(props: {
3
+ value: string;
4
+ label?: React.ReactNode;
5
+ helper?: React.ReactNode;
6
+ height?: number;
7
+ monospace?: boolean;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Label, Textarea, Typography } from "..";
3
+ import { CopyButton } from "./copy-button";
4
+ export function CopyField(props) {
5
+ return (_jsxs("div", { children: [props.label && (_jsx(Label, { children: props.label })), _jsxs("div", { className: "relative pr-2", children: [_jsx(Textarea, { readOnly: true, value: props.value, style: {
6
+ height: props.height,
7
+ fontFamily: props.monospace ? "ui-monospace, monospace" : "inherit",
8
+ whiteSpace: props.monospace ? "pre" : "normal",
9
+ } }), _jsx(CopyButton, { content: props.value, className: "absolute right-4 top-2" })] }), props.helper && (_jsx(Typography, { variant: 'secondary', type: 'label', children: props.helper }))] }));
10
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare function SimpleTooltip(props: {
3
+ tooltip: React.ReactNode;
4
+ children?: React.ReactNode;
5
+ type?: 'info' | 'warning';
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "..";
3
+ import { CircleAlert, Info } from "lucide-react";
4
+ export function SimpleTooltip(props) {
5
+ const icon = props.type === 'warning' ?
6
+ _jsx(CircleAlert, { className: "w-4 h-4 text-zinc-500" }) :
7
+ props.type === 'info' ?
8
+ _jsx(Info, { className: "w-4 h-4 text-zinc-500" }) :
9
+ null;
10
+ return (_jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: "flex items-center gap-1", children: [props.children, " ", icon] }) }), _jsx(TooltipContent, { children: _jsx("div", { className: "max-w-60 text-center text-wrap", children: props.tooltip }) })] }) }));
11
+ }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "default" | "destructive" | "secondary" | "outline" | null | undefined;
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
7
7
  }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const buttonVariants: (props?: ({
4
- variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
4
+ variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
5
5
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  export interface OriginalButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
@@ -12,4 +12,4 @@ interface ButtonProps extends OriginalButtonProps {
12
12
  loading?: boolean;
13
13
  }
14
14
  declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
15
- export { Button, buttonVariants };
15
+ export { Button, buttonVariants, ButtonProps };
@@ -6,7 +6,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
6
6
  ref?: React.Ref<HTMLDivElement> | undefined;
7
7
  } & {
8
8
  asChild?: boolean | undefined;
9
- }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
9
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
10
10
  label?: string | undefined;
11
11
  shouldFilter?: boolean | undefined;
12
12
  filter?: ((value: string, search: string, keywords?: string[] | undefined) => number) | undefined;
@@ -24,7 +24,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
24
24
  ref?: React.Ref<HTMLInputElement> | undefined;
25
25
  } & {
26
26
  asChild?: boolean | undefined;
27
- }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "value" | "type"> & {
27
+ }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
28
28
  value?: string | undefined;
29
29
  onValueChange?: ((search: string) => void) | undefined;
30
30
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -34,7 +34,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
34
34
  ref?: React.Ref<HTMLDivElement> | undefined;
35
35
  } & {
36
36
  asChild?: boolean | undefined;
37
- }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
37
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
38
38
  label?: string | undefined;
39
39
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
40
40
  declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -43,14 +43,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
43
43
  ref?: React.Ref<HTMLDivElement> | undefined;
44
44
  } & {
45
45
  asChild?: boolean | undefined;
46
- }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
46
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
47
47
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
48
48
  children?: React.ReactNode;
49
49
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
50
50
  ref?: React.Ref<HTMLDivElement> | undefined;
51
51
  } & {
52
52
  asChild?: boolean | undefined;
53
- }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
53
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
54
54
  heading?: React.ReactNode;
55
55
  value?: string | undefined;
56
56
  forceMount?: boolean | undefined;
@@ -59,7 +59,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
59
59
  ref?: React.Ref<HTMLDivElement> | undefined;
60
60
  } & {
61
61
  asChild?: boolean | undefined;
62
- }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
62
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
63
63
  alwaysRender?: boolean | undefined;
64
64
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
65
65
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -68,7 +68,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
68
68
  ref?: React.Ref<HTMLDivElement> | undefined;
69
69
  } & {
70
70
  asChild?: boolean | undefined;
71
- }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "onSelect" | "disabled" | "value"> & {
71
+ }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
72
72
  disabled?: boolean | undefined;
73
73
  onSelect?: ((value: string) => void) | undefined;
74
74
  value?: string | undefined;
@@ -1,6 +1,6 @@
1
- import React from "react";
2
1
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
3
- declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
2
+ import React from "react";
3
+ declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuProps & React.RefAttributes<never>>;
4
4
  declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
5
  declare const DropdownMenuGroup: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuGroupProps & React.RefAttributes<HTMLDivElement>>;
6
6
  declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
@@ -11,8 +11,9 @@ declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<Dropd
11
11
  } & React.RefAttributes<HTMLDivElement>>;
12
12
  declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
13
13
  declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
14
- declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
14
+ declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref">, "onClick"> & {
15
15
  inset?: boolean | undefined;
16
+ onClick?: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void | Promise<void>) | undefined;
16
17
  } & React.RefAttributes<HTMLDivElement>>;
17
18
  declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuCheckboxItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
18
19
  declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
@@ -24,4 +25,4 @@ declare const DropdownMenuShortcut: {
24
25
  ({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): import("react/jsx-runtime").JSX.Element;
25
26
  displayName: string;
26
27
  };
27
- export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
28
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
@@ -1,10 +1,28 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import React from "react";
4
3
  import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
5
- import { CheckIcon, ChevronRightIcon, DotFilledIcon, } from "@radix-ui/react-icons";
4
+ import { CheckIcon, ChevronRightIcon, DotFilledIcon } from "@radix-ui/react-icons";
5
+ import React from "react";
6
+ import { useAsyncCallback } from "@stackframe/stack-shared/dist/hooks/use-async-callback";
7
+ import { throwErr } from "@stackframe/stack-shared/dist/utils/errors";
8
+ import { runAsynchronouslyWithAlert } from "@stackframe/stack-shared/dist/utils/promises";
6
9
  import { cn } from "../../lib/utils";
7
- const DropdownMenu = DropdownMenuPrimitive.Root;
10
+ import { Spinner } from "./spinner";
11
+ const DropdownMenuContext = React.createContext(undefined);
12
+ const DropdownMenu = React.forwardRef(({ ...props }, ref) => {
13
+ const [open, setOpen] = React.useState(!!props.open);
14
+ return (_jsx(DropdownMenuContext.Provider, { value: {
15
+ open,
16
+ setOpen: (o) => {
17
+ props.onOpenChange?.(o);
18
+ setOpen(o);
19
+ }
20
+ }, children: _jsx(DropdownMenuPrimitive.Root, { ...props, open: props.open ?? open, onOpenChange: o => {
21
+ props.onOpenChange?.(o);
22
+ setOpen(o);
23
+ } }) }));
24
+ });
25
+ DropdownMenu.displayName = DropdownMenuPrimitive.Root.displayName;
8
26
  const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
9
27
  const DropdownMenuGroup = DropdownMenuPrimitive.Group;
10
28
  const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
@@ -18,7 +36,17 @@ DropdownMenuSubContent.displayName =
18
36
  DropdownMenuPrimitive.SubContent.displayName;
19
37
  const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Portal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
20
38
  DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
21
- const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className), ...props })));
39
+ const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => {
40
+ const { setOpen } = React.useContext(DropdownMenuContext) ?? throwErr("No DropdownMenuContext found");
41
+ const [handleClick, isLoading] = useAsyncCallback(async (e) => {
42
+ await props.onClick?.(e);
43
+ setOpen(false);
44
+ }, [props.onClick]);
45
+ return _jsxs(DropdownMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className), ...props, disabled: isLoading || props.disabled, onClick: props.onClick ? (e) => {
46
+ e.preventDefault();
47
+ runAsynchronouslyWithAlert(handleClick(e));
48
+ } : undefined, children: [_jsx("div", { style: { visibility: isLoading ? "visible" : "hidden", position: "absolute", inset: 0, display: "flex", justifyContent: "center", alignItems: "center" }, children: _jsx(Spinner, {}) }), _jsx("div", { style: { visibility: isLoading ? "hidden" : "visible" }, children: props.children })] });
49
+ });
22
50
  DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
23
51
  const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), checked: checked, ...props, children: [_jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(CheckIcon, { className: "h-4 w-4" }) }) }), children] })));
24
52
  DropdownMenuCheckboxItem.displayName =
@@ -33,4 +61,4 @@ const DropdownMenuShortcut = ({ className, ...props }) => {
33
61
  return (_jsx("span", { className: cn("ml-auto text-xs tracking-widest opacity-60", className), ...props }));
34
62
  };
35
63
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
36
- export { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup, };
64
+ export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger };
@@ -1,5 +1,5 @@
1
- import React from "react";
2
1
  import * as LabelPrimitive from "@radix-ui/react-label";
2
+ import React from "react";
3
3
  import { ControllerProps, FieldPath, FieldValues } from "react-hook-form";
4
4
  declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues extends FieldValues | undefined = undefined>(props: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
5
5
  declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => import("react/jsx-runtime").JSX.Element;
@@ -20,4 +20,4 @@ declare const FormLabel: React.ForwardRefExoticComponent<Omit<LabelPrimitive.Lab
20
20
  declare const FormControl: React.ForwardRefExoticComponent<Omit<import("@radix-ui/react-slot").SlotProps & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
21
21
  declare const FormDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
22
22
  declare const FormMessage: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
23
- export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
23
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
@@ -1,10 +1,11 @@
1
+ 'use client';
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React from "react";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
+ import React from "react";
4
5
  import { Controller, FormProvider, useFormContext, } from "react-hook-form";
6
+ import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
5
7
  import { cn } from "../../lib/utils";
6
8
  import { SpanLabel } from "./label";
7
- import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
8
9
  const Form = FormProvider;
9
10
  const FormFieldContext = React.createContext(null);
10
11
  const FormField = ({ ...props }) => {
@@ -61,4 +62,4 @@ const FormMessage = React.forwardRef(({ className, children, ...props }, ref) =>
61
62
  return (_jsx("p", { ref: ref, id: formMessageId, className: cn("text-[0.8rem] font-medium text-destructive", className), ...props, children: body }));
62
63
  });
63
64
  FormMessage.displayName = "FormMessage";
64
- export { useFormField, Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, };
65
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "containerClassName" | "noScriptCSSFallback"> & {
2
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "containerClassName" | "noScriptCSSFallback"> & {
3
3
  value?: string | undefined;
4
4
  onChange?: ((newValue: string) => unknown) | undefined;
5
5
  maxLength: number;
@@ -11,7 +11,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
11
11
  } & {
12
12
  render: (props: import("input-otp").RenderProps) => React.ReactNode;
13
13
  children?: undefined;
14
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "containerClassName" | "noScriptCSSFallback"> & {
14
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "containerClassName" | "noScriptCSSFallback"> & {
15
15
  value?: string | undefined;
16
16
  onChange?: ((newValue: string) => unknown) | undefined;
17
17
  maxLength: number;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  import React from "react";
3
4
  import { ChevronDownIcon } from "@radix-ui/react-icons";
@@ -1,8 +1,8 @@
1
1
  import { type VariantProps } from "class-variance-authority";
2
2
  import React from "react";
3
3
  declare const typographyVariants: (props?: ({
4
- type?: "h2" | "h3" | "label" | "p" | "h1" | "h4" | "footnote" | null | undefined;
5
- variant?: "destructive" | "success" | "secondary" | "primary" | null | undefined;
4
+ type?: "h1" | "h2" | "h3" | "h4" | "label" | "p" | "footnote" | null | undefined;
5
+ variant?: "destructive" | "secondary" | "success" | "primary" | null | undefined;
6
6
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
7
  interface TypographyProps extends React.HTMLAttributes<HTMLHeadingElement>, VariantProps<typeof typographyVariants> {
8
8
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,12 @@
1
+ export * from "./components/action-dialog";
2
+ export * from "./components/browser-frame";
3
+ export * from "./components/copy-button";
4
+ export * from "./components/copy-field";
5
+ export * from "./components/simple-tooltip";
1
6
  export * from "./components/ui/accordion";
2
7
  export * from "./components/ui/alert";
3
- export * from "./components/ui/avatar";
4
8
  export * from "./components/ui/aspect-ratio";
9
+ export * from "./components/ui/avatar";
5
10
  export * from "./components/ui/badge";
6
11
  export * from "./components/ui/breadcrumb";
7
12
  export * from "./components/ui/button";
@@ -10,19 +15,22 @@ export * from "./components/ui/card";
10
15
  export * from "./components/ui/checkbox";
11
16
  export * from "./components/ui/collapsible";
12
17
  export * from "./components/ui/command";
18
+ export * from "./components/ui/container";
13
19
  export * from "./components/ui/context-menu";
20
+ export * from "./components/ui/dialog";
14
21
  export * from "./components/ui/dropdown-menu";
15
22
  export * from "./components/ui/form";
16
23
  export * from "./components/ui/hover-card";
17
24
  export * from "./components/ui/inline-code";
18
- export * from "./components/ui/input-otp";
19
25
  export * from "./components/ui/input";
26
+ export * from "./components/ui/input-otp";
20
27
  export * from "./components/ui/label";
28
+ export * from "./components/ui/link";
21
29
  export * from "./components/ui/menubar";
22
30
  export * from "./components/ui/navigation-menu";
31
+ export * from "./components/ui/password-input";
23
32
  export * from "./components/ui/popover";
24
33
  export * from "./components/ui/progress";
25
- export * from "./components/ui/progress";
26
34
  export * from "./components/ui/radio-group";
27
35
  export * from "./components/ui/scroll-area";
28
36
  export * from "./components/ui/select";
@@ -41,7 +49,4 @@ export * from "./components/ui/toggle-group";
41
49
  export * from "./components/ui/tooltip";
42
50
  export * from "./components/ui/typography";
43
51
  export * from "./components/ui/use-toast";
44
- export * from "./components/ui/container";
45
- export * from "./components/ui/password-input";
46
- export * from "./components/ui/link";
47
52
  export { cn } from "./lib/utils";
package/dist/index.js CHANGED
@@ -1,7 +1,12 @@
1
+ export * from "./components/action-dialog";
2
+ export * from "./components/browser-frame";
3
+ export * from "./components/copy-button";
4
+ export * from "./components/copy-field";
5
+ export * from "./components/simple-tooltip";
1
6
  export * from "./components/ui/accordion";
2
7
  export * from "./components/ui/alert";
3
- export * from "./components/ui/avatar";
4
8
  export * from "./components/ui/aspect-ratio";
9
+ export * from "./components/ui/avatar";
5
10
  export * from "./components/ui/badge";
6
11
  export * from "./components/ui/breadcrumb";
7
12
  export * from "./components/ui/button";
@@ -10,19 +15,22 @@ export * from "./components/ui/card";
10
15
  export * from "./components/ui/checkbox";
11
16
  export * from "./components/ui/collapsible";
12
17
  export * from "./components/ui/command";
18
+ export * from "./components/ui/container";
13
19
  export * from "./components/ui/context-menu";
20
+ export * from "./components/ui/dialog";
14
21
  export * from "./components/ui/dropdown-menu";
15
22
  export * from "./components/ui/form";
16
23
  export * from "./components/ui/hover-card";
17
24
  export * from "./components/ui/inline-code";
18
- export * from "./components/ui/input-otp";
19
25
  export * from "./components/ui/input";
26
+ export * from "./components/ui/input-otp";
20
27
  export * from "./components/ui/label";
28
+ export * from "./components/ui/link";
21
29
  export * from "./components/ui/menubar";
22
30
  export * from "./components/ui/navigation-menu";
31
+ export * from "./components/ui/password-input";
23
32
  export * from "./components/ui/popover";
24
33
  export * from "./components/ui/progress";
25
- export * from "./components/ui/progress";
26
34
  export * from "./components/ui/radio-group";
27
35
  export * from "./components/ui/scroll-area";
28
36
  export * from "./components/ui/select";
@@ -41,7 +49,4 @@ export * from "./components/ui/toggle-group";
41
49
  export * from "./components/ui/tooltip";
42
50
  export * from "./components/ui/typography";
43
51
  export * from "./components/ui/use-toast";
44
- export * from "./components/ui/container";
45
- export * from "./components/ui/password-input";
46
- export * from "./components/ui/link";
47
52
  export { cn } from "./lib/utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackframe/stack-ui",
3
- "version": "2.5.13",
3
+ "version": "2.5.16",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -66,7 +66,7 @@
66
66
  "react-hook-form": "^7.51.4",
67
67
  "react-resizable-panels": "^2.0.19",
68
68
  "tailwind-merge": "^2.3.0",
69
- "@stackframe/stack-shared": "2.5.13"
69
+ "@stackframe/stack-shared": "2.5.16"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/react": "^18.2.66",