@validationcloud/fractal-ui 1.61.0 → 1.63.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.
- package/dist/components/user-dropdown/user-dropdown.d.ts +2 -4
- package/dist/components/user-dropdown/user-dropdown.js +51 -36
- package/dist/index.d.ts +0 -1
- package/dist/index.js +17 -19
- package/dist/styles/gradients.css +10 -0
- package/package.json +1 -1
- package/dist/components/user-dropdown-mobile/user-dropdown-mobile.d.ts +0 -37
- package/dist/components/user-dropdown-mobile/user-dropdown-mobile.js +0 -59
|
@@ -2,8 +2,6 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { DropdownMenu } from '../dropdown-menu/dropdown-menu';
|
|
3
3
|
type UserWithNameAndPicture = {
|
|
4
4
|
email: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
team?: string;
|
|
7
5
|
picture?: string;
|
|
8
6
|
};
|
|
9
7
|
type UserDropdownProps = {
|
|
@@ -15,7 +13,7 @@ type UserDropdownProps = {
|
|
|
15
13
|
contactItem?: React.ReactNode;
|
|
16
14
|
} & Omit<React.ComponentProps<typeof DropdownMenu>, 'trigger'>;
|
|
17
15
|
/**
|
|
18
|
-
*
|
|
16
|
+
* User dropdown menu that displays a user's email, account, and logout options.
|
|
19
17
|
* @param user - The user to display in the dropdown
|
|
20
18
|
* @param loginUrl - The URL to navigate to the login page
|
|
21
19
|
* @param signupUrl - The URL to navigate to the signup page
|
|
@@ -26,7 +24,7 @@ type UserDropdownProps = {
|
|
|
26
24
|
* @example
|
|
27
25
|
* // Example usage of UserDropdown
|
|
28
26
|
* <UserDropdown
|
|
29
|
-
* user={{ email: 'john.doe@example.com',
|
|
27
|
+
* user={{ email: 'john.doe@example.com', picture: 'picture-url' }}
|
|
30
28
|
* loginUrl="/auth/login"
|
|
31
29
|
* signupUrl="/auth/login?screen_hint=signup"
|
|
32
30
|
* logoutUrl="/auth/logout"
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs as r, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import m from "../../assets/default-avatar.svg.js";
|
|
5
|
+
import { Button as u } from "../button/button.js";
|
|
6
|
+
import { DropdownMenu as f, DropdownMenuItem as i } from "../dropdown-menu/dropdown-menu.js";
|
|
7
|
+
import { Icon as s } from "../icon/icon.js";
|
|
8
|
+
import { twMerge as t } from "../../lib/tailwind-merge.js";
|
|
9
|
+
function C({
|
|
10
|
+
user: l,
|
|
11
|
+
loginUrl: o,
|
|
12
|
+
signupUrl: d,
|
|
13
|
+
logoutUrl: g,
|
|
14
|
+
accountUrl: c,
|
|
15
|
+
contactItem: n,
|
|
16
|
+
className: a,
|
|
17
|
+
...h
|
|
17
18
|
}) {
|
|
18
|
-
return
|
|
19
|
-
|
|
19
|
+
return l ? /* @__PURE__ */ r(
|
|
20
|
+
f,
|
|
20
21
|
{
|
|
21
22
|
trigger: /* @__PURE__ */ r(
|
|
22
23
|
"button",
|
|
@@ -24,39 +25,53 @@ function w({
|
|
|
24
25
|
type: "button",
|
|
25
26
|
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
27
|
children: [
|
|
27
|
-
|
|
28
|
-
/* @__PURE__ */
|
|
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" })
|
|
28
|
+
/* @__PURE__ */ e("img", { className: "size-7 rounded-full sm:size-9", src: l.picture ?? m, alt: "User avatar" }),
|
|
29
|
+
/* @__PURE__ */ e(s, { icon: "chevron", className: "hidden size-2.5 flex-none text-white sm:block sm:size-3" })
|
|
33
30
|
]
|
|
34
31
|
}
|
|
35
32
|
),
|
|
36
|
-
className:
|
|
33
|
+
className: t("tg-caption-bold -mx-2 rounded-xl px-2 py-1", a),
|
|
37
34
|
contentClassName: "bg-neutral-60",
|
|
38
|
-
...
|
|
35
|
+
...h,
|
|
39
36
|
children: [
|
|
40
|
-
/* @__PURE__ */ r(
|
|
41
|
-
/* @__PURE__ */ e(
|
|
42
|
-
/* @__PURE__ */ e("p", { className: "tg-body", children:
|
|
37
|
+
/* @__PURE__ */ r(i, { className: "text-neutral-40 flex cursor-default items-center gap-3", disabled: !0, children: [
|
|
38
|
+
/* @__PURE__ */ e(s, { icon: "user", className: "size-4 flex-none" }),
|
|
39
|
+
/* @__PURE__ */ e("p", { className: "tg-body", children: l.email })
|
|
43
40
|
] }),
|
|
44
|
-
|
|
45
|
-
/* @__PURE__ */ e(
|
|
41
|
+
c && /* @__PURE__ */ e(i, { asChild: !0, children: /* @__PURE__ */ r("a", { href: c, className: "flex items-center gap-3", children: [
|
|
42
|
+
/* @__PURE__ */ e(s, { icon: "cog", className: "size-4 flex-none text-white" }),
|
|
46
43
|
/* @__PURE__ */ e("p", { className: "tg-body", children: "Account" })
|
|
47
44
|
] }) }),
|
|
48
|
-
|
|
49
|
-
/* @__PURE__ */ e(
|
|
50
|
-
/* @__PURE__ */ e(
|
|
45
|
+
n && /* @__PURE__ */ e(i, { asChild: !0, children: n }),
|
|
46
|
+
/* @__PURE__ */ e(i, { asChild: !0, children: /* @__PURE__ */ r("a", { href: g, className: "flex items-center gap-3", children: [
|
|
47
|
+
/* @__PURE__ */ e(s, { icon: "logout", className: "size-4 flex-none text-white" }),
|
|
51
48
|
/* @__PURE__ */ e("p", { className: "tg-body", children: "Log out" })
|
|
52
49
|
] }) })
|
|
53
50
|
]
|
|
54
51
|
}
|
|
55
|
-
) : /* @__PURE__ */ r(
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
|
|
52
|
+
) : /* @__PURE__ */ r(p, { children: [
|
|
53
|
+
/* @__PURE__ */ r("div", { className: t("hidden gap-3 sm:flex", a), children: [
|
|
54
|
+
/* @__PURE__ */ e(u, { variant: "secondary", size: "medium", asChild: !0, children: /* @__PURE__ */ e("a", { href: o, children: "Log in" }) }),
|
|
55
|
+
/* @__PURE__ */ e(u, { variant: "primary", size: "medium", asChild: !0, children: /* @__PURE__ */ e("a", { href: d, children: "Sign up" }) })
|
|
56
|
+
] }),
|
|
57
|
+
/* @__PURE__ */ r(
|
|
58
|
+
f,
|
|
59
|
+
{
|
|
60
|
+
trigger: /* @__PURE__ */ e("img", { className: "size-7 cursor-pointer sm:hidden", src: m, alt: "User avatar" }),
|
|
61
|
+
className: t(
|
|
62
|
+
"hover:bg-neutral-60 focus-visible:ring-neutral-60 data-[state=open]:bg-neutral-60 rounded-full outline-none focus-visible:ring-2 sm:hidden",
|
|
63
|
+
a
|
|
64
|
+
),
|
|
65
|
+
...h,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e(i, { asChild: !0, children: /* @__PURE__ */ e("a", { href: o, className: "tg-body", children: "Log in" }) }),
|
|
68
|
+
/* @__PURE__ */ e(i, { asChild: !0, children: /* @__PURE__ */ e("a", { href: d, className: "tg-body", children: "Sign up" }) }),
|
|
69
|
+
n && /* @__PURE__ */ e(i, { children: n })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
58
73
|
] });
|
|
59
74
|
}
|
|
60
75
|
export {
|
|
61
|
-
|
|
76
|
+
C as UserDropdown
|
|
62
77
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -25,5 +25,4 @@ export { TooltipProvider } from './components/tooltip-provider/tooltip-provider'
|
|
|
25
25
|
export { TouchTarget } from './components/touch-target/touch-target';
|
|
26
26
|
export { twMerge } from './lib/tailwind-merge';
|
|
27
27
|
export { UserDropdown } from './components/user-dropdown/user-dropdown';
|
|
28
|
-
export { UserDropdownMobile } from './components/user-dropdown-mobile/user-dropdown-mobile';
|
|
29
28
|
export { useScrollToBottom } from './hooks/use-scroll-to-bottom';
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { AnimatedLoader as
|
|
1
|
+
import { AnimatedLoader as t } from "./components/animated-loader/animated-loader.js";
|
|
2
2
|
import { Badge as p } from "./components/badge/badge.js";
|
|
3
3
|
import { Box as x } from "./components/box/box.js";
|
|
4
4
|
import { Button as n } from "./components/button/button.js";
|
|
5
|
-
import { ClientModal as
|
|
6
|
-
import { Collapsible as
|
|
5
|
+
import { ClientModal as a } from "./components/client-modal/client-modal.js";
|
|
6
|
+
import { Collapsible as u, CollapsibleContent as i, CollapsibleTrigger as c } from "./components/collapsible/collapsible.js";
|
|
7
7
|
import { CopyButton as B } from "./components/copy-button/copy-button.js";
|
|
8
8
|
import { DecoratedIcon as C } from "./components/decorated-icon/decorated-icon.js";
|
|
9
9
|
import { DropdownMenu as T, DropdownMenuItem as s } from "./components/dropdown-menu/dropdown-menu.js";
|
|
10
10
|
import { ErrorBoundary as M } from "./components/error-boundary/error-boundary.js";
|
|
11
|
-
import { ScrollArea as
|
|
11
|
+
import { ScrollArea as P } from "./components/scroll-area/index.js";
|
|
12
12
|
import { Icon as h } from "./components/icon/icon.js";
|
|
13
13
|
import { IconButton as y } from "./components/icon-button/icon-button.js";
|
|
14
14
|
import { InputButton as L } from "./components/input-button/input-button.js";
|
|
15
|
-
import { MountSvgSprite as
|
|
16
|
-
import { NotFoundComponent as
|
|
15
|
+
import { MountSvgSprite as E } from "./components/mount-svg-sprite/mount-svg-sprite.js";
|
|
16
|
+
import { NotFoundComponent as N } from "./components/not-found-component/not-found-component.js";
|
|
17
17
|
import { PagePadding as j } from "./components/page-padding/page-padding.js";
|
|
18
18
|
import { ProtocolLogo as z } from "./components/protocol-logo/protocol-logo.js";
|
|
19
19
|
import { Select as H, SelectItem as J } from "./components/select/select.js";
|
|
@@ -23,18 +23,17 @@ import { TextInput as W } from "./components/text-input/text-input.js";
|
|
|
23
23
|
import { Tooltip as Y } from "./components/tooltip/tooltip.js";
|
|
24
24
|
import { TooltipProvider as _ } from "./components/tooltip-provider/tooltip-provider.js";
|
|
25
25
|
import { TouchTarget as oo } from "./components/touch-target/touch-target.js";
|
|
26
|
-
import { twMerge as
|
|
26
|
+
import { twMerge as to } from "./lib/tailwind-merge.js";
|
|
27
27
|
import { UserDropdown as po } from "./components/user-dropdown/user-dropdown.js";
|
|
28
|
-
import {
|
|
29
|
-
import { useScrollToBottom as no } from "./hooks/use-scroll-to-bottom.js";
|
|
28
|
+
import { useScrollToBottom as xo } from "./hooks/use-scroll-to-bottom.js";
|
|
30
29
|
export {
|
|
31
|
-
|
|
30
|
+
t as AnimatedLoader,
|
|
32
31
|
p as Badge,
|
|
33
32
|
x as Box,
|
|
34
33
|
n as Button,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
a as ClientModal,
|
|
35
|
+
u as Collapsible,
|
|
36
|
+
i as CollapsibleContent,
|
|
38
37
|
c as CollapsibleTrigger,
|
|
39
38
|
B as CopyButton,
|
|
40
39
|
C as DecoratedIcon,
|
|
@@ -44,11 +43,11 @@ export {
|
|
|
44
43
|
h as Icon,
|
|
45
44
|
y as IconButton,
|
|
46
45
|
L as InputButton,
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
E as MountSvgSprite,
|
|
47
|
+
N as NotFoundComponent,
|
|
49
48
|
j as PagePadding,
|
|
50
49
|
z as ProtocolLogo,
|
|
51
|
-
|
|
50
|
+
P as ScrollArea,
|
|
52
51
|
H as Select,
|
|
53
52
|
J as SelectItem,
|
|
54
53
|
O as Skeleton,
|
|
@@ -58,7 +57,6 @@ export {
|
|
|
58
57
|
_ as TooltipProvider,
|
|
59
58
|
oo as TouchTarget,
|
|
60
59
|
po as UserDropdown,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
no as useScrollToBottom
|
|
60
|
+
to as twMerge,
|
|
61
|
+
xo as useScrollToBottom
|
|
64
62
|
};
|
|
@@ -77,6 +77,16 @@
|
|
|
77
77
|
--background-image-gradient12: linear-gradient(269deg, #fff 11.19%, #e4e7f5 50.65%, #d2d8ee 76.77%, #3d476d 112.51%);
|
|
78
78
|
--background-image-gradient13: radial-gradient(circle, #1a1d1f 0%, #1a1d1f 45%, #6f767e 100%);
|
|
79
79
|
--background-image-gradient14: linear-gradient(327deg, #fff 0%, #e4e7f5 38.95%, #d2d8ee 64.79%, #3d476d 100%);
|
|
80
|
+
--background-image-gradient15: conic-gradient(
|
|
81
|
+
from 30deg,
|
|
82
|
+
#825a67 0deg,
|
|
83
|
+
#825a67 30deg,
|
|
84
|
+
#ad818c 45deg,
|
|
85
|
+
#50434e 90deg,
|
|
86
|
+
#3d323d 225deg,
|
|
87
|
+
#443843 270deg,
|
|
88
|
+
#825a67 360deg
|
|
89
|
+
);
|
|
80
90
|
--background-image-angular: conic-gradient(
|
|
81
91
|
from 180deg at 50% 50%,
|
|
82
92
|
#eb9eab 0deg,
|
package/package.json
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,59 +0,0 @@
|
|
|
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
|
-
};
|