@validationcloud/fractal-ui 1.46.0 → 1.48.0

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.
@@ -1 +1 @@
1
- export declare const protocolLogoIds: readonly ["abs", "aleo", "ape", "apt", "arb", "astr", "avax", "axl", "b2", "babylon", "base", "bera", "bnb", "bob", "btc", "btr", "celo", "cfx", "core", "corn", "cro", "cspr", "eigenlayer", "eth", "eth_light", "fhe", "frax", "gno", "hash", "hbar", "hsk", "hype", "icp", "ink", "kat", "lens", "linea", "lsk", "matic", "merl", "metal", "metis", "mezo", "mint", "mnt", "mode", "mon", "obol", "okb", "op", "opbnb", "optimism", "plume", "rbtc", "ron", "s", "saga", "sauce", "scr", "sei", "shibarium", "sol", "soneium", "ssv", "starknet", "stt", "supr", "taiko", "tac", "tao", "ton", "trx", "uni", "union", "wemix", "wld", "xlm", "xtz", "zk"];
1
+ export declare const protocolLogoIds: readonly ["abs", "aleo", "ape", "apt", "arb", "astr", "avax", "axl", "b2", "babylon", "base", "bera", "bnb", "bob", "btc", "btr", "celo", "cfx", "core", "corn", "cro", "cspr", "eigenlayer", "eth", "eth_light", "fhe", "frax", "gno", "hash", "hbar", "hsk", "hype", "icp", "ink", "jovay", "kat", "lens", "linea", "lsk", "matic", "merl", "metal", "metis", "mezo", "mint", "mnt", "mode", "mon", "obol", "okb", "op", "opbnb", "optimism", "plume", "rbtc", "ron", "s", "saga", "sauce", "scr", "sei", "shibarium", "sol", "soneium", "ssv", "starknet", "stt", "supr", "taiko", "tac", "tao", "ton", "trx", "uni", "union", "wemix", "wld", "xlm", "xtz", "zk"];
@@ -1,12 +1,7 @@
1
- import { Root, Scrollbar, Thumb, Corner } from './scroll-area';
1
+ import { Corner, Root, Scrollbar, Thumb, Viewport } from './scroll-area';
2
2
  export declare const ScrollArea: {
3
3
  Root: typeof Root;
4
- Viewport: import('react').ForwardRefExoticComponent<{
5
- autoScrollToBottom?: boolean;
6
- nearBottomThreshold?: number;
7
- onNearBottomChange?: (isNearBottom: boolean) => void;
8
- snapToBottomOnMount?: boolean;
9
- } & Omit<import('@radix-ui/react-scroll-area').ScrollAreaViewportProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
4
+ Viewport: typeof Viewport;
10
5
  Scrollbar: typeof Scrollbar;
11
6
  Thumb: typeof Thumb;
12
7
  Corner: typeof Corner;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsxs as v, jsx as g } from "react/jsx-runtime";
3
- import { composeRefs as H } from "../../../node_modules/@radix-ui/react-compose-refs/dist/index.js";
3
+ import { composeRefs as H } from "../../../node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.js";
4
4
  import { ScrollArea as x } from "radix-ui";
5
5
  import { forwardRef as q, useRef as u, useEffect as i } from "react";
6
6
  import { useScrollToBottom as F } from "../../hooks/use-scroll-to-bottom.js";
@@ -0,0 +1,38 @@
1
+ import { default as React } from 'react';
2
+ import { DropdownMenu } from '../dropdown-menu/dropdown-menu';
3
+ type UserWithNameAndPicture = {
4
+ email: string;
5
+ name?: string;
6
+ team?: string;
7
+ picture?: string;
8
+ };
9
+ type UserDropdownProps = {
10
+ user: UserWithNameAndPicture | undefined;
11
+ loginUrl: string;
12
+ signupUrl: string;
13
+ logoutUrl: string;
14
+ accountUrl?: string;
15
+ contactItem?: React.ReactNode;
16
+ } & Omit<React.ComponentProps<typeof DropdownMenu>, 'trigger'>;
17
+ /**
18
+ * A component that displays a not found message and a button to navigate to the specified page.
19
+ * @param user - The user to display in the dropdown
20
+ * @param loginUrl - The URL to navigate to the login page
21
+ * @param signupUrl - The URL to navigate to the signup page
22
+ * @param logoutUrl - The URL to navigate to the logout page
23
+ * @param accountUrl - The URL to navigate to the account page
24
+ * @param contactItem - The item to display in the contact dropdown
25
+
26
+ * @example
27
+ * // Example usage of UserDropdown
28
+ * <UserDropdown
29
+ * user={{ email: 'john.doe@example.com', name: 'John Doe', team: 'Validation Cloud', picture: 'picture-url' }}
30
+ * loginUrl="/auth/login"
31
+ * signupUrl="/auth/login?screen_hint=signup"
32
+ * logoutUrl="/auth/logout"
33
+ * accountUrl="/account"
34
+ * contactItem={<IntercomButton><Icon icon="help-center"/><p className="tg-body">Contact Support</p></IntercomButton>}
35
+ * />
36
+ */
37
+ export declare function UserDropdown({ user, loginUrl, signupUrl, logoutUrl, accountUrl, contactItem, className, ...props }: UserDropdownProps): import("react/jsx-runtime").JSX.Element;
38
+ export {};
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
3
+ import "react";
4
+ import { Button as c } from "../button/button.js";
5
+ import { DropdownMenu as p, DropdownMenuItem as n } from "../dropdown-menu/dropdown-menu.js";
6
+ import { Icon as t } from "../icon/icon.js";
7
+ import { twMerge as o } from "../../lib/tailwind-merge.js";
8
+ function w({
9
+ user: i,
10
+ loginUrl: d,
11
+ signupUrl: m,
12
+ logoutUrl: h,
13
+ accountUrl: l,
14
+ contactItem: a,
15
+ className: s,
16
+ ...u
17
+ }) {
18
+ return i ? /* @__PURE__ */ r(
19
+ p,
20
+ {
21
+ trigger: /* @__PURE__ */ r(
22
+ "button",
23
+ {
24
+ type: "button",
25
+ className: "gap-r3 focus-visible:ring-neutral-40 flex h-10 shrink cursor-pointer flex-row items-center overflow-hidden px-3 py-6 focus:outline-none focus-visible:rounded-xl focus-visible:ring-2",
26
+ children: [
27
+ i.picture && /* @__PURE__ */ e("img", { className: "hidden size-9 rounded-full sm:block", src: i.picture, alt: "User avatar" }),
28
+ /* @__PURE__ */ r("div", { className: "flex shrink flex-col items-start truncate", children: [
29
+ /* @__PURE__ */ e("span", { className: "tg-caption-bold truncate", children: i.name || i.email }),
30
+ i.team && /* @__PURE__ */ e("p", { className: "tg-caption text-neutral-40", children: i.team })
31
+ ] }),
32
+ /* @__PURE__ */ e(t, { icon: "chevron", className: "size-3 flex-none text-white" })
33
+ ]
34
+ }
35
+ ),
36
+ className: o("tg-caption-bold -mx-2 rounded-xl px-2 py-1", s),
37
+ contentClassName: "bg-neutral-60",
38
+ ...u,
39
+ children: [
40
+ /* @__PURE__ */ r(n, { className: "text-neutral-40 flex cursor-default items-center gap-3", disabled: !0, children: [
41
+ /* @__PURE__ */ e(t, { icon: "user", className: "size-4 flex-none" }),
42
+ /* @__PURE__ */ e("p", { className: "tg-body", children: i.email })
43
+ ] }),
44
+ l && /* @__PURE__ */ e(n, { asChild: !0, children: /* @__PURE__ */ r("a", { href: l, className: "flex items-center gap-3", children: [
45
+ /* @__PURE__ */ e(t, { icon: "cog", className: "size-4 flex-none text-white" }),
46
+ /* @__PURE__ */ e("p", { className: "tg-body", children: "Account" })
47
+ ] }) }),
48
+ a && /* @__PURE__ */ e(n, { asChild: !0, children: a }),
49
+ /* @__PURE__ */ e(n, { asChild: !0, children: /* @__PURE__ */ r("a", { href: h, className: "flex items-center gap-3", children: [
50
+ /* @__PURE__ */ e(t, { icon: "logout", className: "size-4 flex-none text-white" }),
51
+ /* @__PURE__ */ e("p", { className: "tg-body", children: "Log out" })
52
+ ] }) })
53
+ ]
54
+ }
55
+ ) : /* @__PURE__ */ r("div", { className: o("flex gap-3", s), children: [
56
+ /* @__PURE__ */ e(c, { variant: "secondary", size: "medium", asChild: !0, children: /* @__PURE__ */ e("a", { href: d, children: "Log in" }) }),
57
+ /* @__PURE__ */ e(c, { variant: "primary", size: "medium", asChild: !0, children: /* @__PURE__ */ e("a", { href: m, children: "Sign up" }) })
58
+ ] });
59
+ }
60
+ export {
61
+ w as UserDropdown
62
+ };
@@ -0,0 +1,37 @@
1
+ import { DropdownMenu } from '../dropdown-menu/dropdown-menu';
2
+ type UserWithNameAndPicture = {
3
+ email: string;
4
+ name?: string;
5
+ team?: string;
6
+ picture?: string;
7
+ };
8
+ type UserDropdownMobileProps = {
9
+ user: UserWithNameAndPicture | undefined;
10
+ loginUrl: string;
11
+ signupUrl: string;
12
+ logoutUrl: string;
13
+ accountUrl?: string;
14
+ contactItem?: React.ReactNode;
15
+ } & Omit<React.ComponentProps<typeof DropdownMenu>, 'trigger'>;
16
+ /**
17
+ * A component that displays a not found message and a button to navigate to the specified page.
18
+ * @param user - The user to display in the dropdown
19
+ * @param loginUrl - The URL to navigate to the login page
20
+ * @param signupUrl - The URL to navigate to the signup page
21
+ * @param logoutUrl - The URL to navigate to the logout page
22
+ * @param accountUrl - The URL to navigate to the account page
23
+ * @param contactItem - The item to display in the contact dropdown
24
+
25
+ * @example
26
+ * // Example usage of UserDropdown
27
+ * <UserDropdown
28
+ * user={{ email: 'john.doe@example.com', name: 'John Doe', team: 'Validation Cloud', picture: 'picture-url' }}
29
+ * loginUrl="/auth/login"
30
+ * signupUrl="/auth/login?screen_hint=signup"
31
+ * logoutUrl="/auth/logout"
32
+ * accountUrl="/account"
33
+ * contactItem={<IntercomButton><Icon icon="help-center"/><p className="tg-body">Contact Support</p></IntercomButton>}
34
+ * />
35
+ */
36
+ export declare function UserDropdownMobile({ user, loginUrl, signupUrl, logoutUrl, accountUrl, contactItem, className, ...props }: UserDropdownMobileProps): import("react/jsx-runtime").JSX.Element;
37
+ export {};
@@ -0,0 +1,59 @@
1
+ import { jsxs as l, jsx as e, Fragment as t } from "react/jsx-runtime";
2
+ import u from "../../assets/default-avatar.svg.js";
3
+ import { DropdownMenu as g, DropdownMenuItem as r } from "../dropdown-menu/dropdown-menu.js";
4
+ import { Icon as n } from "../icon/icon.js";
5
+ import { twMerge as f } from "../../lib/tailwind-merge.js";
6
+ function v({
7
+ user: i,
8
+ loginUrl: o,
9
+ signupUrl: c,
10
+ logoutUrl: d,
11
+ accountUrl: s,
12
+ contactItem: a,
13
+ className: h,
14
+ ...m
15
+ }) {
16
+ return /* @__PURE__ */ l(
17
+ g,
18
+ {
19
+ trigger: /* @__PURE__ */ e(
20
+ "img",
21
+ {
22
+ className: "size-7 cursor-pointer",
23
+ src: i && i.picture ? i.picture : u,
24
+ alt: "User avatar"
25
+ }
26
+ ),
27
+ className: f(
28
+ "hover:bg-neutral-60 focus-visible:ring-neutral-60 data-[state=open]:bg-neutral-60 rounded-full outline-none focus-visible:ring-2",
29
+ h
30
+ ),
31
+ ...m,
32
+ children: [
33
+ !i && /* @__PURE__ */ l(t, { children: [
34
+ /* @__PURE__ */ e(r, { asChild: !0, children: /* @__PURE__ */ e("a", { href: o, className: "tg-body", children: "Log in" }) }),
35
+ /* @__PURE__ */ e(r, { asChild: !0, children: /* @__PURE__ */ e("a", { href: c, className: "tg-body", children: "Sign up" }) }),
36
+ a && /* @__PURE__ */ e(r, { children: a })
37
+ ] }),
38
+ i && /* @__PURE__ */ l(t, { children: [
39
+ /* @__PURE__ */ l(r, { className: "text-neutral-40 flex cursor-default items-center gap-3", disabled: !0, children: [
40
+ /* @__PURE__ */ e(n, { icon: "user", className: "size-4 flex-none" }),
41
+ /* @__PURE__ */ e("p", { className: "tg-body", children: i.email })
42
+ ] }),
43
+ s && /* @__PURE__ */ e(r, { asChild: !0, children: /* @__PURE__ */ l("a", { href: s, className: "flex items-center gap-3", children: [
44
+ /* @__PURE__ */ e(n, { icon: "cog", className: "size-4 flex-none text-white" }),
45
+ /* @__PURE__ */ e("p", { className: "tg-body", children: "Account" })
46
+ ] }) }),
47
+ a && /* @__PURE__ */ e(r, { asChild: !0, children: a }),
48
+ /* @__PURE__ */ e(r, { asChild: !0, children: /* @__PURE__ */ l("a", { href: d, className: "flex items-center gap-3", children: [
49
+ /* @__PURE__ */ e(n, { icon: "logout", className: "size-4 flex-none text-white" }),
50
+ /* @__PURE__ */ e("p", { className: "tg-body", children: "Log out" })
51
+ ] }) })
52
+ ] })
53
+ ]
54
+ }
55
+ );
56
+ }
57
+ export {
58
+ v as UserDropdownMobile
59
+ };
@@ -22,4 +22,6 @@ export { Tooltip } from './components/tooltip/tooltip';
22
22
  export { TooltipProvider } from './components/tooltip-provider/tooltip-provider';
23
23
  export { TouchTarget } from './components/touch-target/touch-target';
24
24
  export { twMerge } from './lib/tailwind-merge';
25
+ export { UserDropdown } from './components/user-dropdown/user-dropdown';
26
+ export { UserDropdownMobile } from './components/user-dropdown-mobile/user-dropdown-mobile';
25
27
  export { useScrollToBottom } from './hooks/use-scroll-to-bottom';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@validationcloud/fractal-ui",
3
3
  "private": false,
4
- "version": "1.46.0",
4
+ "version": "1.48.0",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
7
7
  "files": [
@@ -32,6 +32,10 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
+ "packageManager": "pnpm@10.20.0",
36
+ "engines": {
37
+ "node": ">=22.0.0"
38
+ },
35
39
  "dependencies": {
36
40
  "radix-ui": "^1",
37
41
  "react": "^19",
@@ -71,6 +75,7 @@
71
75
  "vite-plugin-dts": "^4.5.4"
72
76
  },
73
77
  "peerDependencies": {
78
+ "@radix-ui/react-compose-refs": "^1",
74
79
  "radix-ui": "^1",
75
80
  "react": "^19",
76
81
  "react-dom": "^19",