@slyxup/ui 0.2.7 → 0.2.9

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.
Files changed (35) hide show
  1. package/README.md +4 -1
  2. package/dist/components/SignIn/SignIn.d.ts.map +1 -1
  3. package/dist/components/SignIn/SignIn.js +2 -1
  4. package/dist/components/SignIn/SignIn.js.map +1 -1
  5. package/dist/components/SignUp/SignUp.d.ts.map +1 -1
  6. package/dist/components/SignUp/SignUp.js +2 -1
  7. package/dist/components/SignUp/SignUp.js.map +1 -1
  8. package/dist/components/SocialButtons/SocialButtons.d.ts.map +1 -1
  9. package/dist/components/SocialButtons/SocialButtons.js +2 -1
  10. package/dist/components/SocialButtons/SocialButtons.js.map +1 -1
  11. package/dist/components/UserButton/UserButton.d.ts +5 -1
  12. package/dist/components/UserButton/UserButton.d.ts.map +1 -1
  13. package/dist/components/UserButton/UserButton.js +6 -2
  14. package/dist/components/UserButton/UserButton.js.map +1 -1
  15. package/dist/components/UserProfile/UserProfile.d.ts.map +1 -1
  16. package/dist/components/UserProfile/UserProfile.js +248 -27
  17. package/dist/components/UserProfile/UserProfile.js.map +1 -1
  18. package/dist/index.d.ts +3 -1
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/styles.d.ts +1 -1
  23. package/dist/styles.d.ts.map +1 -1
  24. package/dist/styles.js +269 -0
  25. package/dist/styles.js.map +1 -1
  26. package/package.json +9 -9
  27. package/src/components/SignIn/SignIn.tsx +2 -1
  28. package/src/components/SignUp/SignUp.tsx +2 -1
  29. package/src/components/SocialButtons/SocialButtons.tsx +2 -1
  30. package/src/components/UserButton/UserButton.tsx +12 -2
  31. package/src/components/UserProfile/UserProfile.tsx +556 -61
  32. package/src/index.ts +12 -1
  33. package/src/styles.ts +269 -0
  34. package/.turbo/turbo-build.log +0 -4
  35. package/LICENSE +0 -21
@@ -7,8 +7,13 @@ function initials(name: string | null | undefined, email: string): string {
7
7
  return email.slice(0, 1).toUpperCase();
8
8
  }
9
9
 
10
+ export interface UserButtonProps {
11
+ /** Called when "Profile settings" is clicked. Use to open <UserProfile />. */
12
+ onProfileClick?: () => void;
13
+ }
14
+
10
15
  /** Avatar + dropdown with profile actions and sign out. */
11
- export function UserButton() {
16
+ export function UserButton({ onProfileClick }: UserButtonProps) {
12
17
  injectStyles();
13
18
  const { isLoaded, user } = useUser();
14
19
  const { signOut } = useAuth();
@@ -36,6 +41,11 @@ export function UserButton() {
36
41
  const email = user?.email ?? '';
37
42
  const name = user?.firstName;
38
43
 
44
+ function handleProfileClick() {
45
+ setOpen(false);
46
+ onProfileClick?.();
47
+ }
48
+
39
49
  async function onSignOut() {
40
50
  await signOut();
41
51
  setOpen(false);
@@ -72,7 +82,7 @@ export function UserButton() {
72
82
  type="button"
73
83
  className="slx-menu-item"
74
84
  role="menuitem"
75
- onClick={() => setOpen(false)}
85
+ onClick={handleProfileClick}
76
86
  >
77
87
  Profile settings
78
88
  </button>