@gen3/frontend 0.10.83 → 0.10.84
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/cjs/index.js +126 -88
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/features/Navigation/ActionMenu.d.ts +2 -2
- package/dist/dts/features/Navigation/ActionMenu.d.ts.map +1 -1
- package/dist/dts/features/Navigation/ActionMenu.js.map +1 -1
- package/dist/dts/features/Navigation/Header.js +1 -1
- package/dist/dts/features/Navigation/Header.js.map +1 -1
- package/dist/dts/features/Navigation/HorizontalClean/HorizontalNavigationBar.d.ts +1 -1
- package/dist/dts/features/Navigation/HorizontalClean/HorizontalNavigationBar.d.ts.map +1 -1
- package/dist/dts/features/Navigation/TopBar/AccountButton.d.ts +5 -0
- package/dist/dts/features/Navigation/TopBar/AccountButton.d.ts.map +1 -0
- package/dist/dts/features/Navigation/TopBar/AccountButton.js +78 -0
- package/dist/dts/features/Navigation/TopBar/AccountButton.js.map +1 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.d.ts +11 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.d.ts.map +1 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.js +23 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.js.map +1 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.stories.d.ts +35 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.stories.d.ts.map +1 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.stories.js +40 -0
- package/dist/dts/features/Navigation/TopBar/IconButton.stories.js.map +1 -0
- package/dist/dts/features/Navigation/TopBar/LoginButton.d.ts +10 -0
- package/dist/dts/features/Navigation/TopBar/LoginButton.d.ts.map +1 -0
- package/dist/dts/features/Navigation/TopBar/LoginButton.js +80 -0
- package/dist/dts/features/Navigation/TopBar/LoginButton.js.map +1 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.d.ts +13 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.d.ts.map +1 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.js +39 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.js.map +1 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.stories.d.ts +14 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.stories.d.ts.map +1 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.stories.js +44 -0
- package/dist/dts/features/Navigation/TopBar/TopBar.stories.js.map +1 -0
- package/dist/dts/features/Navigation/Vertical/VerticalTopBar.d.ts +1 -1
- package/dist/dts/features/Navigation/Vertical/VerticalTopBar.d.ts.map +1 -1
- package/dist/dts/features/Navigation/index.d.ts +1 -1
- package/dist/dts/features/Navigation/index.d.ts.map +1 -1
- package/dist/dts/features/Navigation/types.d.ts +8 -1
- package/dist/dts/features/Navigation/types.d.ts.map +1 -1
- package/dist/dts/index.d.ts +1 -1
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/index.js +1 -1
- package/dist/dts/index.js.map +1 -1
- package/dist/esm/index.js +126 -88
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +15 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -1012,13 +1012,13 @@ var LoginButtonVisibility = /*#__PURE__*/ function(LoginButtonVisibility) {
|
|
|
1012
1012
|
};
|
|
1013
1013
|
const mergeTailwindClassnameWithDefault = (userValues, defaultValues)=>userValues ? tailwindMerge.twMerge(defaultValues, userValues) : defaultValues;
|
|
1014
1014
|
|
|
1015
|
-
const handleSelected = async (isAuthenticated, router, referrer, endSession, externalLoginUrl)=>{
|
|
1015
|
+
const handleSelected$1 = async (isAuthenticated, router, referrer, endSession, externalLoginUrl)=>{
|
|
1016
1016
|
if (!isAuthenticated) await router.push(externalLoginUrl || `Login?redirect=${referrer}`);
|
|
1017
1017
|
else {
|
|
1018
1018
|
if (endSession) endSession();
|
|
1019
1019
|
}
|
|
1020
1020
|
};
|
|
1021
|
-
const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
|
|
1021
|
+
const LoginButton$1 = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
|
|
1022
1022
|
className: "pl-1",
|
|
1023
1023
|
size: '1.55rem'
|
|
1024
1024
|
}), hideText = false, className = undefined, tooltip, visibility, externalLoginUrl })=>{
|
|
@@ -1040,7 +1040,7 @@ const LoginButton = ({ icon = /*#__PURE__*/ jsxRuntime.jsx(md.MdLogin, {
|
|
|
1040
1040
|
disabled: tooltip === undefined,
|
|
1041
1041
|
classNames: TooltipStyle,
|
|
1042
1042
|
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.UnstyledButton, {
|
|
1043
|
-
onClick: ()=>handleSelected(authenticated, router$1, pathname, endSession, externalLoginUrl),
|
|
1043
|
+
onClick: ()=>handleSelected$1(authenticated, router$1, pathname, endSession, externalLoginUrl),
|
|
1044
1044
|
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
1045
1045
|
className: mergedClassname,
|
|
1046
1046
|
children: [
|
|
@@ -3057,27 +3057,6 @@ const Gen3Link = ({ className, href, linkType, text, showExternalIcon = false })
|
|
|
3057
3057
|
});
|
|
3058
3058
|
};
|
|
3059
3059
|
|
|
3060
|
-
const LoginAccountButton = ({ className = undefined })=>{
|
|
3061
|
-
const router$1 = router.useRouter();
|
|
3062
|
-
const handleSelected = async ()=>{
|
|
3063
|
-
await router$1.push('Profile');
|
|
3064
|
-
};
|
|
3065
|
-
const userStatus = core.useCoreSelector((state)=>core.selectUserAuthStatus(state));
|
|
3066
|
-
const userInfo = core.useCoreSelector((state)=>core.selectUserDetails(state));
|
|
3067
|
-
const mergedClassname = mergeTailwindClassnameWithDefault(className, 'flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent');
|
|
3068
|
-
if (userStatus && core.isAuthenticated(userStatus)) {
|
|
3069
|
-
return /*#__PURE__*/ jsxRuntime.jsx(core$1.UnstyledButton, {
|
|
3070
|
-
className: "mx-2",
|
|
3071
|
-
onClick: ()=>handleSelected(),
|
|
3072
|
-
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
3073
|
-
className: mergedClassname,
|
|
3074
|
-
children: userInfo?.username
|
|
3075
|
-
})
|
|
3076
|
-
});
|
|
3077
|
-
}
|
|
3078
|
-
return null;
|
|
3079
|
-
};
|
|
3080
|
-
|
|
3081
3060
|
const IconSize = {
|
|
3082
3061
|
xs: 14,
|
|
3083
3062
|
sm: 16,
|
|
@@ -3087,7 +3066,7 @@ const IconSize = {
|
|
|
3087
3066
|
'xl-2': 36
|
|
3088
3067
|
};
|
|
3089
3068
|
|
|
3090
|
-
const
|
|
3069
|
+
const IconButton = ({ name, leftIcon = undefined, rightIcon = undefined, iconSize = 'md', tooltip = undefined, classNames = {}, clickHandler = undefined, ariaLabel = undefined })=>{
|
|
3091
3070
|
const classNamesDefaults = {
|
|
3092
3071
|
root: `flex items-center align-middle px-2 my-2`,
|
|
3093
3072
|
button: 'flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent',
|
|
@@ -3100,53 +3079,111 @@ const TopIconButton = ({ name, leftIcon = undefined, rightIcon = undefined, icon
|
|
|
3100
3079
|
const iconSz = IconSize[iconSize] ?? iconSize;
|
|
3101
3080
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
3102
3081
|
className: extractClassName('root', mergedClassnames),
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3082
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(core$1.Tooltip, {
|
|
3083
|
+
label: tooltip,
|
|
3084
|
+
position: "bottom",
|
|
3085
|
+
withArrow: true,
|
|
3086
|
+
multiline: true,
|
|
3087
|
+
color: "base",
|
|
3088
|
+
disabled: tooltip === undefined,
|
|
3089
|
+
classNames: TooltipStyle,
|
|
3090
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
3091
|
+
className: extractClassName('button', mergedClassnames),
|
|
3092
|
+
role: "button",
|
|
3093
|
+
"aria-label": ariaLabel ?? name,
|
|
3094
|
+
onClick: (event)=>clickHandler && clickHandler(),
|
|
3095
|
+
children: [
|
|
3096
|
+
leftIcon ? /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
|
|
3097
|
+
icon: leftIcon,
|
|
3098
|
+
width: iconSz,
|
|
3099
|
+
height: iconSz,
|
|
3100
|
+
className: extractClassName('leftIcon', mergedClassnames)
|
|
3101
|
+
}) : null,
|
|
3102
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
3103
|
+
className: extractClassName('label', mergedClassnames),
|
|
3104
|
+
children: name
|
|
3105
|
+
}),
|
|
3106
|
+
rightIcon && rightIcon.length > 0 ? /*#__PURE__*/ jsxRuntime.jsx(react.Icon, {
|
|
3107
|
+
width: iconSz,
|
|
3108
|
+
height: iconSz,
|
|
3109
|
+
icon: rightIcon,
|
|
3110
|
+
className: extractClassName('rightIcon', mergedClassnames)
|
|
3111
|
+
}) : null
|
|
3112
|
+
]
|
|
3113
|
+
})
|
|
3129
3114
|
})
|
|
3130
3115
|
});
|
|
3131
3116
|
};
|
|
3132
|
-
|
|
3117
|
+
|
|
3118
|
+
const AccountButton = ({ leftIcon = undefined, rightIcon = undefined, iconSize = 'md', classNames = {}, tooltip = 'See account profile' })=>{
|
|
3119
|
+
const classNamesDefaults = {
|
|
3120
|
+
root: `flex items-center align-middle px-2 my-2`,
|
|
3121
|
+
button: 'flex flex-nowrap items-center align-middle border-b-2 hover:border-accent border-transparent',
|
|
3122
|
+
leftIcon: 'text-secondary-contrast-lighter pr-1',
|
|
3123
|
+
label: 'font-content text-secondary-contrast-lighter block',
|
|
3124
|
+
rightIcon: 'text-secondary-contrast-lighter pl-1'
|
|
3125
|
+
};
|
|
3126
|
+
const mergedClassnames = mergeDefaultTailwindClassnames(classNamesDefaults, classNames);
|
|
3127
|
+
const router$1 = router.useRouter();
|
|
3128
|
+
const handleSelected = async ()=>{
|
|
3129
|
+
await router$1.push('Profile');
|
|
3130
|
+
};
|
|
3131
|
+
const userInfo = core.useCoreSelector((state)=>core.selectUserDetails(state));
|
|
3132
|
+
const userStatus = core.useCoreSelector((state)=>core.selectUserAuthStatus(state));
|
|
3133
|
+
const authenticated = core.isAuthenticated(userStatus);
|
|
3134
|
+
if (!authenticated) return null;
|
|
3135
|
+
return /*#__PURE__*/ jsxRuntime.jsx(IconButton, {
|
|
3136
|
+
name: userInfo?.username ?? 'Profile',
|
|
3137
|
+
leftIcon: leftIcon,
|
|
3138
|
+
rightIcon: rightIcon,
|
|
3139
|
+
iconSize: iconSize,
|
|
3140
|
+
classNames: mergedClassnames,
|
|
3141
|
+
clickHandler: handleSelected,
|
|
3142
|
+
tooltip: tooltip
|
|
3143
|
+
});
|
|
3144
|
+
};
|
|
3145
|
+
|
|
3146
|
+
const handleSelected = async (isAuthenticated, router, referrer, endSession, externalLoginUrl)=>{
|
|
3147
|
+
if (!isAuthenticated) await router.push(externalLoginUrl || `Login?redirect=${referrer}`);
|
|
3148
|
+
else {
|
|
3149
|
+
if (endSession) endSession();
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
const LoginButton = ({ name = 'login', leftIcon = undefined, rightIcon = undefined, tooltip = 'Login to your account', visibility, externalLoginUrl, iconSize = 'md', classNames = {} })=>{
|
|
3153
|
+
const router$1 = router.useRouter();
|
|
3154
|
+
const pathname = navigation.usePathname();
|
|
3155
|
+
const { endSession } = React.useContext(SessionContext) ?? {
|
|
3156
|
+
endSession: undefined
|
|
3157
|
+
};
|
|
3158
|
+
const userStatus = core.useCoreSelector((state)=>core.selectUserAuthStatus(state));
|
|
3159
|
+
const authenticated = core.isAuthenticated(userStatus);
|
|
3160
|
+
if (visibility === LoginButtonVisibility.LogoutOnly && !authenticated) return null;
|
|
3161
|
+
return /*#__PURE__*/ jsxRuntime.jsx(IconButton, {
|
|
3162
|
+
name: authenticated ? 'Logout' : 'Login',
|
|
3163
|
+
leftIcon: leftIcon,
|
|
3164
|
+
rightIcon: authenticated ? 'gen3:logout' : 'gen3:login',
|
|
3165
|
+
iconSize: iconSize,
|
|
3166
|
+
classNames: classNames,
|
|
3167
|
+
clickHandler: ()=>handleSelected(authenticated, router$1, pathname, endSession, externalLoginUrl)
|
|
3168
|
+
});
|
|
3169
|
+
};
|
|
3170
|
+
|
|
3171
|
+
const processTopBarItems = (items, classNames, dividerClassname)=>{
|
|
3133
3172
|
return items.reduce((acc, item, index)=>{
|
|
3134
|
-
const needsBorder = !(index === items.length - 1 && !showLogin);
|
|
3135
3173
|
const mergedClassnames = item?.classNames ? mergeDefaultTailwindClassnames(classNames, item.classNames) : classNames;
|
|
3136
|
-
acc.push(/*#__PURE__*/ jsxRuntime.jsxs(
|
|
3137
|
-
className: "flex",
|
|
3138
|
-
href: item.href,
|
|
3174
|
+
acc.push(/*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3139
3175
|
children: [
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3176
|
+
/*#__PURE__*/ jsxRuntime.jsx("a", {
|
|
3177
|
+
className: "flex",
|
|
3178
|
+
href: item.href,
|
|
3179
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(IconButton, {
|
|
3180
|
+
name: item.name,
|
|
3181
|
+
iconSize: item.iconSize,
|
|
3182
|
+
leftIcon: item.leftIcon,
|
|
3183
|
+
rightIcon: item.rightIcon,
|
|
3184
|
+
classNames: mergedClassnames
|
|
3185
|
+
})
|
|
3186
|
+
}, `${item.href}_${item.name}`),
|
|
3150
3187
|
/*#__PURE__*/ jsxRuntime.jsx(core$1.Divider, {
|
|
3151
3188
|
size: "md",
|
|
3152
3189
|
orientation: "vertical",
|
|
@@ -3155,7 +3192,7 @@ const processTopBarItems = (items, showLogin, classNames, dividerClassname)=>{
|
|
|
3155
3192
|
}
|
|
3156
3193
|
})
|
|
3157
3194
|
]
|
|
3158
|
-
}
|
|
3195
|
+
}));
|
|
3159
3196
|
return acc;
|
|
3160
3197
|
}, []);
|
|
3161
3198
|
};
|
|
@@ -3182,29 +3219,30 @@ const TopBar = ({ items, loginButtonVisibility = LoginButtonVisibility.Hidden, e
|
|
|
3182
3219
|
"aria-label": "top most navigation",
|
|
3183
3220
|
className: "flex items-center align-middle",
|
|
3184
3221
|
children: [
|
|
3185
|
-
processTopBarItems(items,
|
|
3186
|
-
loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsxRuntime.jsxs(
|
|
3187
|
-
className: "flex items-center",
|
|
3222
|
+
processTopBarItems(items, mergedItemClassnames, extractClassName('divider', mergedClassnames)),
|
|
3223
|
+
loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3188
3224
|
children: [
|
|
3189
|
-
/*#__PURE__*/ jsxRuntime.
|
|
3190
|
-
className:
|
|
3225
|
+
/*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
3226
|
+
className: "flex items-center align-middle [&>*:only-child]:hidden",
|
|
3227
|
+
children: [
|
|
3228
|
+
/*#__PURE__*/ jsxRuntime.jsx(AccountButton, {
|
|
3229
|
+
classNames: mergedItemClassnames
|
|
3230
|
+
}),
|
|
3231
|
+
/*#__PURE__*/ jsxRuntime.jsx(core$1.Divider, {
|
|
3232
|
+
size: "md",
|
|
3233
|
+
classNames: {
|
|
3234
|
+
root: extractClassName('divider', mergedClassnames)
|
|
3235
|
+
},
|
|
3236
|
+
orientation: "vertical"
|
|
3237
|
+
})
|
|
3238
|
+
]
|
|
3191
3239
|
}),
|
|
3192
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
},
|
|
3197
|
-
orientation: "vertical"
|
|
3240
|
+
/*#__PURE__*/ jsxRuntime.jsx(LoginButton, {
|
|
3241
|
+
visibility: loginButtonVisibility,
|
|
3242
|
+
externalLoginUrl: externalLoginUrl,
|
|
3243
|
+
classNames: mergedItemClassnames
|
|
3198
3244
|
})
|
|
3199
3245
|
]
|
|
3200
|
-
}) : null,
|
|
3201
|
-
loginButtonVisibility != LoginButtonVisibility.Hidden ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
3202
|
-
className: "flex items-center",
|
|
3203
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(LoginButton, {
|
|
3204
|
-
visibility: loginButtonVisibility,
|
|
3205
|
-
externalLoginUrl: externalLoginUrl,
|
|
3206
|
-
className: extractClassName('login', mergedClassnames)
|
|
3207
|
-
})
|
|
3208
3246
|
}) : null
|
|
3209
3247
|
]
|
|
3210
3248
|
})
|
|
@@ -3538,7 +3576,7 @@ const HorizontalNavigationBar = ({ actions, items, logo = undefined, loginIcon =
|
|
|
3538
3576
|
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
3539
3577
|
className: "flex items-center align-middle mr-3",
|
|
3540
3578
|
children: [
|
|
3541
|
-
actions.loginButtonVisibility === LoginButtonVisibility.Visible ? /*#__PURE__*/ jsxRuntime.jsx(LoginButton, {
|
|
3579
|
+
actions.loginButtonVisibility === LoginButtonVisibility.Visible ? /*#__PURE__*/ jsxRuntime.jsx(LoginButton$1, {
|
|
3542
3580
|
icon: loginIcon,
|
|
3543
3581
|
hideText: true,
|
|
3544
3582
|
className: `${extractClassName('login', mergedClassnames)}`,
|
|
@@ -20864,7 +20902,7 @@ exports.Header = Header;
|
|
|
20864
20902
|
exports.HoverLink = HoverLink;
|
|
20865
20903
|
exports.LandingPage = LandingPage;
|
|
20866
20904
|
exports.LandingPageGetStaticProps = LandingPageGetStaticProps;
|
|
20867
|
-
exports.LoginButton = LoginButton;
|
|
20905
|
+
exports.LoginButton = LoginButton$1;
|
|
20868
20906
|
exports.LoginPage = LoginPage;
|
|
20869
20907
|
exports.LoginPageGetServerSideProps = LoginPageGetServerSideProps;
|
|
20870
20908
|
exports.LoginPanel = LoginPanel;
|