@riligar/auth-react 1.34.0 → 1.35.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/index.js CHANGED
@@ -2965,6 +2965,157 @@ function UserProfile({
2965
2965
  });
2966
2966
  }
2967
2967
 
2968
+ function UserInformation({
2969
+ user,
2970
+ signOut,
2971
+ onAccountClick,
2972
+ onBillingClick,
2973
+ accountLabel = 'Conta',
2974
+ billingLabel = 'Assinatura',
2975
+ padded = true,
2976
+ size = 'sm',
2977
+ style,
2978
+ ...others
2979
+ }) {
2980
+ if (!user) return null;
2981
+
2982
+ // Size mappings
2983
+ const avatarSizeMap = {
2984
+ sm: 32,
2985
+ md: 40,
2986
+ lg: 48
2987
+ };
2988
+ const fontSizeTitleMap = {
2989
+ sm: 'sm',
2990
+ md: 'md',
2991
+ lg: 'lg'
2992
+ };
2993
+ const fontSizeEmailMap = {
2994
+ sm: '10px',
2995
+ md: 'xs',
2996
+ lg: 'sm'
2997
+ };
2998
+ const btnSizeMap = {
2999
+ sm: 'xs',
3000
+ md: 'sm',
3001
+ lg: 'md'
3002
+ };
3003
+ const gapMap = {
3004
+ sm: 'xs',
3005
+ md: 'sm',
3006
+ lg: 'md'
3007
+ };
3008
+ const widthMap = {
3009
+ sm: 280,
3010
+ md: 320,
3011
+ lg: 400
3012
+ };
3013
+ const name = user.fullName || user.name || 'User';
3014
+ const email = user.primaryEmailAddress || user.email || '';
3015
+ const initials = name.split(' ').map(n => n[0]).join('').toUpperCase().slice(0, 2);
3016
+ return /*#__PURE__*/jsxRuntime.jsx(core.Box, {
3017
+ p: padded ? gapMap[size] : 0,
3018
+ w: widthMap[size],
3019
+ style: style,
3020
+ ...others,
3021
+ children: /*#__PURE__*/jsxRuntime.jsxs(core.Stack, {
3022
+ gap: gapMap[size],
3023
+ children: [/*#__PURE__*/jsxRuntime.jsxs(core.Group, {
3024
+ wrap: "nowrap",
3025
+ gap: "xs",
3026
+ children: [/*#__PURE__*/jsxRuntime.jsx(core.Avatar, {
3027
+ src: user.imageUrl || user.image,
3028
+ size: avatarSizeMap[size],
3029
+ radius: "xl",
3030
+ bg: "gray.1",
3031
+ c: "gray.6",
3032
+ styles: {
3033
+ placeholder: {
3034
+ fontSize: core.rem(avatarSizeMap[size] / 2.2),
3035
+ fontWeight: 600
3036
+ }
3037
+ },
3038
+ children: initials || 'CC'
3039
+ }), /*#__PURE__*/jsxRuntime.jsxs(core.Box, {
3040
+ style: {
3041
+ flex: 1,
3042
+ overflow: 'hidden'
3043
+ },
3044
+ children: [/*#__PURE__*/jsxRuntime.jsx(core.Text, {
3045
+ size: fontSizeTitleMap[size],
3046
+ fw: 700,
3047
+ truncate: "end",
3048
+ c: "dark.9",
3049
+ lh: 1.1,
3050
+ children: name
3051
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Text, {
3052
+ size: fontSizeEmailMap[size],
3053
+ c: "gray.5",
3054
+ truncate: "end",
3055
+ lh: 1.1,
3056
+ children: email
3057
+ })]
3058
+ }), /*#__PURE__*/jsxRuntime.jsx(core.ActionIcon, {
3059
+ variant: "subtle",
3060
+ color: "gray.4",
3061
+ size: size,
3062
+ onClick: signOut,
3063
+ children: /*#__PURE__*/jsxRuntime.jsx(iconsReact.IconLogout, {
3064
+ size: avatarSizeMap[size] * 0.45
3065
+ })
3066
+ })]
3067
+ }), /*#__PURE__*/jsxRuntime.jsxs(core.Group, {
3068
+ gap: gapMap[size] === 'xs' ? 6 : 8,
3069
+ grow: true,
3070
+ children: [/*#__PURE__*/jsxRuntime.jsx(core.Button, {
3071
+ variant: "default",
3072
+ size: btnSizeMap[size],
3073
+ leftSection: /*#__PURE__*/jsxRuntime.jsx(iconsReact.IconSettings, {
3074
+ size: avatarSizeMap[size] * 0.45
3075
+ }),
3076
+ onClick: onAccountClick,
3077
+ fw: 700,
3078
+ fz: gapMap[size] === 'xs' ? "10px" : "xs",
3079
+ radius: "md",
3080
+ children: accountLabel
3081
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Button, {
3082
+ variant: "default",
3083
+ size: btnSizeMap[size],
3084
+ leftSection: /*#__PURE__*/jsxRuntime.jsx(iconsReact.IconCreditCard, {
3085
+ size: avatarSizeMap[size] * 0.45
3086
+ }),
3087
+ onClick: onBillingClick,
3088
+ fw: 700,
3089
+ fz: gapMap[size] === 'xs' ? "10px" : "xs",
3090
+ radius: "md",
3091
+ children: billingLabel
3092
+ })]
3093
+ }), /*#__PURE__*/jsxRuntime.jsxs(core.Group, {
3094
+ justify: "center",
3095
+ gap: 4,
3096
+ opacity: 0.3,
3097
+ children: [/*#__PURE__*/jsxRuntime.jsx(core.Text, {
3098
+ size: "10px",
3099
+ c: "gray.6",
3100
+ fw: 600,
3101
+ children: "Secured by"
3102
+ }), /*#__PURE__*/jsxRuntime.jsxs(core.Group, {
3103
+ gap: 2,
3104
+ children: [/*#__PURE__*/jsxRuntime.jsx(iconsReact.IconShieldCheck, {
3105
+ size: 10,
3106
+ stroke: 2
3107
+ }), /*#__PURE__*/jsxRuntime.jsx(core.Text, {
3108
+ size: "10px",
3109
+ fw: 800,
3110
+ c: "dark.9",
3111
+ children: "Auth"
3112
+ })]
3113
+ })]
3114
+ })]
3115
+ })
3116
+ });
3117
+ }
3118
+
2968
3119
  /**
2969
3120
  * Renderiza children apenas quando o usuário está autenticado
2970
3121
  * Equivalente ao <SignedIn> do Clerk
@@ -3090,6 +3241,7 @@ exports.SignUpButton = SignUpButton;
3090
3241
  exports.SignUpForm = SignUp;
3091
3242
  exports.SignedIn = SignedIn;
3092
3243
  exports.SignedOut = SignedOut;
3244
+ exports.UserInformation = UserInformation;
3093
3245
  exports.UserProfile = UserProfile;
3094
3246
  exports.VerifyEmail = VerifyEmail;
3095
3247
  exports.VerifyEmailCard = VerifyEmail;