@asgardeo/react 0.3.0 → 0.5.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/README.md +5 -1
- package/dist/AsgardeoReactClient.d.ts +12 -4
- package/dist/__temp__/api.d.ts +26 -21
- package/dist/__temp__/models.d.ts +14 -22
- package/dist/api/scim2/createOrganization.d.ts +74 -0
- package/dist/api/scim2/getAllOrganizations.d.ts +56 -0
- package/dist/api/scim2/getMeOrganizations.d.ts +52 -0
- package/dist/api/scim2/getOrganization.d.ts +61 -0
- package/dist/api/scim2/updateOrganization.d.ts +74 -0
- package/dist/cjs/index.js +9863 -1190
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts +7 -6
- package/dist/components/actions/SignInButton/SignInButton.d.ts +21 -2
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts +7 -6
- package/dist/components/actions/SignOutButton/SignOutButton.d.ts +22 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts +6 -5
- package/dist/components/actions/SignUpButton/SignUpButton.d.ts +21 -0
- package/dist/components/control/AsgardeoLoading.d.ts +45 -0
- package/dist/components/factories/FieldFactory.d.ts +107 -0
- package/dist/components/presentation/CreateOrganization/BaseCreateOrganization.d.ts +53 -0
- package/dist/components/presentation/CreateOrganization/CreateOrganization.d.ts +67 -0
- package/dist/components/presentation/Organization/BaseOrganization.d.ts +66 -0
- package/dist/components/presentation/Organization/Organization.d.ts +66 -0
- package/dist/components/presentation/OrganizationList/BaseOrganizationList.d.ts +117 -0
- package/dist/components/presentation/OrganizationList/OrganizationList.d.ts +93 -0
- package/dist/components/presentation/OrganizationProfile/BaseOrganizationProfile.d.ts +153 -0
- package/dist/components/presentation/OrganizationProfile/OrganizationProfile.d.ts +119 -0
- package/dist/components/presentation/OrganizationSwitcher/BaseOrganizationSwitcher.d.ts +141 -0
- package/dist/components/presentation/OrganizationSwitcher/OrganizationSwitcher.d.ts +70 -0
- package/dist/components/presentation/SignIn/BaseSignIn.d.ts +114 -0
- package/dist/components/presentation/SignIn/SignIn.d.ts +63 -0
- package/dist/components/presentation/SignIn/options/EmailOtp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/FacebookButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/GitHubButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/GoogleButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/IdentifierFirst.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/LinkedInButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/MicrosoftButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/MultiOptionButton.d.ts +26 -0
- package/dist/components/presentation/SignIn/options/SignInOptionFactory.d.ts +76 -0
- package/dist/components/presentation/SignIn/options/SignInWithEthereumButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/SmsOtp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/SocialButton.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/Totp.d.ts +25 -0
- package/dist/components/presentation/SignIn/options/UsernamePassword.d.ts +25 -0
- package/dist/components/presentation/SignIn/types.d.ts +124 -0
- package/dist/components/presentation/SignUp/BaseSignUp.d.ts +126 -0
- package/dist/components/presentation/SignUp/SignUp.d.ts +55 -0
- package/dist/components/presentation/SignUp/options/CheckboxInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/DateInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/DividerComponent.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/EmailInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/FormContainer.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/GoogleButton.d.ts +25 -0
- package/dist/components/presentation/SignUp/options/ImageComponent.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/NumberInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/PasswordInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/SignUpOptionFactory.d.ts +100 -0
- package/dist/components/presentation/SignUp/options/SocialButton.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/SubmitButton.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/TelephoneInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/TextInput.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/Typography.d.ts +24 -0
- package/dist/components/presentation/SignUp/options/index.d.ts +26 -0
- package/dist/components/presentation/User/BaseUser.d.ts +66 -0
- package/dist/components/presentation/{User.d.ts → User/User.d.ts} +9 -4
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts +34 -22
- package/dist/components/presentation/UserDropdown/UserDropdown.d.ts +60 -4
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +34 -11
- package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
- package/dist/components/primitives/Alert/Alert.d.ts +74 -0
- package/dist/components/primitives/Avatar/Avatar.d.ts +21 -8
- package/dist/components/primitives/Button/Button.d.ts +83 -0
- package/dist/components/primitives/Card/Card.d.ts +132 -0
- package/dist/components/primitives/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/primitives/Divider/Divider.d.ts +58 -0
- package/dist/components/primitives/FormControl/FormControl.d.ts +50 -0
- package/dist/components/primitives/Icons/Building.d.ts +40 -0
- package/dist/components/primitives/Icons/BuildingAlt.d.ts +40 -0
- package/dist/components/primitives/Icons/Check.d.ts +40 -0
- package/dist/components/primitives/Icons/ChevronDown.d.ts +40 -0
- package/dist/components/primitives/Icons/CircleAlert.d.ts +23 -0
- package/dist/components/primitives/Icons/CircleCheck.d.ts +23 -0
- package/dist/components/primitives/Icons/Eye.d.ts +23 -0
- package/dist/components/primitives/Icons/EyeOff.d.ts +23 -0
- package/dist/components/primitives/Icons/Info.d.ts +23 -0
- package/dist/components/primitives/Icons/LogOut.d.ts +23 -0
- package/dist/components/primitives/Icons/Plus.d.ts +23 -0
- package/dist/components/primitives/Icons/Settings.d.ts +0 -0
- package/dist/components/primitives/Icons/TriangleAlert.d.ts +23 -0
- package/dist/components/primitives/Icons/User.d.ts +23 -0
- package/dist/components/primitives/Icons/X.d.ts +23 -0
- package/dist/components/primitives/Icons/index.d.ts +27 -0
- package/dist/components/primitives/InputLabel/InputLabel.d.ts +46 -0
- package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts +123 -0
- package/dist/components/primitives/KeyValueInput/index.d.ts +0 -0
- package/dist/components/primitives/OtpField/OtpField.d.ts +86 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts +31 -0
- package/dist/components/primitives/Popover/Popover.d.ts +73 -36
- package/dist/components/primitives/Select/Select.d.ts +1 -1
- package/dist/components/primitives/Spinner/Spinner.d.ts +54 -0
- package/dist/components/primitives/TextField/TextField.d.ts +18 -2
- package/dist/components/primitives/Typography/Typography.d.ts +81 -0
- package/dist/contexts/{AsgardeoContext.d.ts → Asgardeo/AsgardeoContext.d.ts} +3 -1
- package/dist/{providers → contexts/Asgardeo}/AsgardeoProvider.d.ts +1 -1
- package/dist/{hooks → contexts/Asgardeo}/useAsgardeo.d.ts +1 -1
- package/dist/contexts/Flow/FlowContext.d.ts +73 -0
- package/dist/contexts/Flow/FlowProvider.d.ts +46 -0
- package/dist/contexts/Flow/useFlow.d.ts +48 -0
- package/dist/contexts/I18n/I18nContext.d.ts +42 -0
- package/dist/contexts/I18n/I18nProvider.d.ts +31 -0
- package/dist/contexts/I18n/useI18n.d.ts +27 -0
- package/dist/contexts/Organization/OrganizationContext.d.ts +74 -0
- package/dist/contexts/Organization/OrganizationProvider.d.ts +90 -0
- package/dist/contexts/Organization/useOrganization.d.ts +104 -0
- package/dist/{theme → contexts/Theme}/ThemeProvider.d.ts +2 -1
- package/dist/{theme → contexts/Theme}/types.d.ts +38 -9
- package/dist/{theme → contexts/Theme}/useTheme.d.ts +2 -1
- package/dist/contexts/User/UserContext.d.ts +33 -0
- package/dist/contexts/User/UserProvider.d.ts +56 -0
- package/dist/contexts/User/useUser.d.ts +94 -0
- package/dist/hooks/useForm.d.ts +192 -0
- package/dist/hooks/useTranslation.d.ts +52 -0
- package/dist/index.d.ts +133 -9
- package/dist/index.js +9949 -1203
- package/dist/index.js.map +4 -4
- package/dist/utils/getMappedUserProfileValue.d.ts +33 -1
- package/package.json +6 -5
- package/dist/utils/getUserProfile.d.ts +0 -59
- /package/dist/{theme → contexts/Theme}/ThemeContext.d.ts +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Telephone input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const TelephoneInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default TelephoneInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Text input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const TextInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default TextInput;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignUpOptionProps } from './SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Typography component for sign-up forms (titles, descriptions, etc.).
|
|
22
|
+
*/
|
|
23
|
+
declare const TypographyComponent: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default TypographyComponent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export { default as TextInput } from './TextInput';
|
|
19
|
+
export { default as EmailInput } from './EmailInput';
|
|
20
|
+
export { default as PasswordInput } from './PasswordInput';
|
|
21
|
+
export { default as SubmitButton } from './SubmitButton';
|
|
22
|
+
export { default as SocialButton } from './SocialButton';
|
|
23
|
+
export { default as GoogleButton } from './GoogleButton';
|
|
24
|
+
export { default as Typography } from './Typography';
|
|
25
|
+
export { default as FormContainer } from './FormContainer';
|
|
26
|
+
export { createSignUpComponent, createSignUpOptionFromComponent, renderSignUpComponents, type BaseSignUpOptionProps, } from './SignUpOptionFactory';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { User as IUser } from '@asgardeo/browser';
|
|
19
|
+
import { FC, ReactNode } from 'react';
|
|
20
|
+
/**
|
|
21
|
+
* Props for the BaseUser component.
|
|
22
|
+
*/
|
|
23
|
+
export interface BaseUserProps {
|
|
24
|
+
/**
|
|
25
|
+
* The user object to display. If not provided, the component will render the fallback.
|
|
26
|
+
*/
|
|
27
|
+
user: IUser | null;
|
|
28
|
+
/**
|
|
29
|
+
* Render prop that takes the user object and returns a ReactNode.
|
|
30
|
+
* @param user - The authenticated user object from Asgardeo.
|
|
31
|
+
* @returns A ReactNode to render.
|
|
32
|
+
*/
|
|
33
|
+
children: (user: IUser | null) => ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Optional element to render when no user is provided.
|
|
36
|
+
*/
|
|
37
|
+
fallback?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Base User component that provides the core functionality for displaying user information.
|
|
41
|
+
* This component takes a user object as a prop and uses render props to expose it.
|
|
42
|
+
*
|
|
43
|
+
* @remarks This is the base component that can be used in any context where you have
|
|
44
|
+
* a user object available. For React applications, use the User component which
|
|
45
|
+
* automatically retrieves the user from Asgardeo context.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* import { BaseUser } from '@asgardeo/auth-react';
|
|
50
|
+
*
|
|
51
|
+
* const MyComponent = ({ user }) => {
|
|
52
|
+
* return (
|
|
53
|
+
* <BaseUser user={user} fallback={<p>No user data</p>}>
|
|
54
|
+
* {(user) => (
|
|
55
|
+
* <div>
|
|
56
|
+
* <h1>Welcome, {user.displayName}!</h1>
|
|
57
|
+
* <p>Email: {user.email}</p>
|
|
58
|
+
* </div>
|
|
59
|
+
* )}
|
|
60
|
+
* </BaseUser>
|
|
61
|
+
* );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const BaseUser: FC<BaseUserProps>;
|
|
66
|
+
export default BaseUser;
|
|
@@ -15,18 +15,20 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { User as
|
|
18
|
+
import { User as IUser } from '@asgardeo/browser';
|
|
19
19
|
import { FC, ReactNode } from 'react';
|
|
20
|
+
import { BaseUserProps } from './BaseUser';
|
|
20
21
|
/**
|
|
21
22
|
* Props for the User component.
|
|
23
|
+
* Extends BaseUserProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
22
24
|
*/
|
|
23
|
-
export interface UserProps {
|
|
25
|
+
export interface UserProps extends Omit<BaseUserProps, 'user'> {
|
|
24
26
|
/**
|
|
25
27
|
* Render prop that takes the user object and returns a ReactNode.
|
|
26
28
|
* @param user - The authenticated user object from Asgardeo.
|
|
27
29
|
* @returns A ReactNode to render.
|
|
28
30
|
*/
|
|
29
|
-
children: (user:
|
|
31
|
+
children: (user: IUser | null) => ReactNode;
|
|
30
32
|
/**
|
|
31
33
|
* Optional element to render when no user is signed in.
|
|
32
34
|
*/
|
|
@@ -34,10 +36,13 @@ export interface UserProps {
|
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* A component that uses render props to expose the authenticated user object.
|
|
39
|
+
* This component automatically retrieves the user from Asgardeo context.
|
|
40
|
+
*
|
|
41
|
+
* @remarks This component is only supported in browser based React applications (CSR).
|
|
37
42
|
*
|
|
38
43
|
* @example
|
|
39
44
|
* ```tsx
|
|
40
|
-
* import {
|
|
45
|
+
* import { IUser } from '@asgardeo/auth-react';
|
|
41
46
|
*
|
|
42
47
|
* const App = () => {
|
|
43
48
|
* return (
|
|
@@ -16,56 +16,68 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { FC, ReactElement, ReactNode } from 'react';
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
interface MenuItem {
|
|
20
|
+
href?: string;
|
|
21
21
|
icon?: ReactNode;
|
|
22
|
+
label: ReactNode;
|
|
22
23
|
onClick?: () => void;
|
|
23
|
-
href?: string;
|
|
24
24
|
}
|
|
25
25
|
export interface BaseUserDropdownProps {
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Mapping of component attribute names to identity provider field names.
|
|
28
|
+
* Allows customizing which user profile fields should be used for each attribute.
|
|
28
29
|
*/
|
|
29
|
-
|
|
30
|
+
attributeMapping?: {
|
|
31
|
+
[key: string]: string | string[] | undefined;
|
|
32
|
+
firstName?: string | string[];
|
|
33
|
+
lastName?: string | string[];
|
|
34
|
+
picture?: string | string[];
|
|
35
|
+
username?: string | string[];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Optional size for the avatar
|
|
39
|
+
*/
|
|
40
|
+
avatarSize?: number;
|
|
30
41
|
/**
|
|
31
42
|
* Optional className for the dropdown container.
|
|
32
43
|
*/
|
|
33
44
|
className?: string;
|
|
34
45
|
/**
|
|
35
|
-
*
|
|
46
|
+
* Optional element to render when no user is signed in.
|
|
36
47
|
*/
|
|
37
|
-
|
|
48
|
+
fallback?: ReactElement;
|
|
38
49
|
/**
|
|
39
|
-
*
|
|
50
|
+
* Whether the user data is currently loading
|
|
40
51
|
*/
|
|
41
|
-
|
|
52
|
+
isLoading?: boolean;
|
|
42
53
|
/**
|
|
43
54
|
* Menu items to display in the dropdown
|
|
44
55
|
*/
|
|
45
56
|
menuItems?: MenuItem[];
|
|
46
57
|
/**
|
|
47
|
-
*
|
|
58
|
+
* Callback function for "Manage Profile" action
|
|
59
|
+
*/
|
|
60
|
+
onManageProfile?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback function for "Sign Out" action
|
|
48
63
|
*/
|
|
49
|
-
|
|
64
|
+
onSignOut?: () => void;
|
|
65
|
+
/**
|
|
66
|
+
* The HTML element ID where the portal should be mounted
|
|
67
|
+
*/
|
|
68
|
+
portalId?: string;
|
|
50
69
|
/**
|
|
51
70
|
* Show dropdown header with user information
|
|
52
71
|
*/
|
|
53
72
|
showDropdownHeader?: boolean;
|
|
54
73
|
/**
|
|
55
|
-
*
|
|
74
|
+
* Show user's display name next to avatar in the trigger button
|
|
56
75
|
*/
|
|
57
|
-
|
|
76
|
+
showTriggerLabel?: boolean;
|
|
58
77
|
/**
|
|
59
|
-
*
|
|
60
|
-
* Allows customizing which user profile fields should be used for each attribute.
|
|
78
|
+
* The user object containing profile information
|
|
61
79
|
*/
|
|
62
|
-
|
|
63
|
-
picture?: string | string[];
|
|
64
|
-
firstName?: string | string[];
|
|
65
|
-
lastName?: string | string[];
|
|
66
|
-
username?: string | string[];
|
|
67
|
-
[key: string]: string | string[] | undefined;
|
|
68
|
-
};
|
|
80
|
+
user: any;
|
|
69
81
|
}
|
|
70
82
|
/**
|
|
71
83
|
* BaseUserDropdown component displays a user avatar with a dropdown menu.
|
|
@@ -15,19 +15,54 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
-
import { FC } from 'react';
|
|
18
|
+
import { FC, ReactNode } from 'react';
|
|
19
19
|
import { BaseUserDropdownProps } from './BaseUserDropdown';
|
|
20
|
+
/**
|
|
21
|
+
* Render props data passed to the children function
|
|
22
|
+
*/
|
|
23
|
+
export interface UserDropdownRenderProps {
|
|
24
|
+
/** Function to close the profile dialog */
|
|
25
|
+
closeProfile: () => void;
|
|
26
|
+
/** Whether user data is currently loading */
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
/** Whether the profile dialog is currently open */
|
|
29
|
+
isProfileOpen: boolean;
|
|
30
|
+
/** Function to open the user profile dialog */
|
|
31
|
+
openProfile: () => void;
|
|
32
|
+
/** Function to sign out the user */
|
|
33
|
+
signOut: () => void;
|
|
34
|
+
/** The authenticated user object */
|
|
35
|
+
user: any;
|
|
36
|
+
}
|
|
20
37
|
/**
|
|
21
38
|
* Props for the UserDropdown component.
|
|
22
|
-
* Extends BaseUserDropdownProps but
|
|
39
|
+
* Extends BaseUserDropdownProps but excludes user, onManageProfile, and onSignOut since they're handled internally
|
|
23
40
|
*/
|
|
24
|
-
export type UserDropdownProps = Omit<BaseUserDropdownProps, 'user'
|
|
41
|
+
export type UserDropdownProps = Omit<BaseUserDropdownProps, 'user' | 'onManageProfile'> & {
|
|
42
|
+
/**
|
|
43
|
+
* Render prop function that receives user state and actions.
|
|
44
|
+
* When provided, this completely replaces the default dropdown rendering.
|
|
45
|
+
*/
|
|
46
|
+
children?: (props: UserDropdownRenderProps) => ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Custom render function for the dropdown content.
|
|
49
|
+
* When provided, this replaces just the dropdown content while keeping the trigger.
|
|
50
|
+
*/
|
|
51
|
+
renderDropdown?: (props: UserDropdownRenderProps) => ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Custom render function for the trigger button.
|
|
54
|
+
* When provided, this replaces just the trigger button while keeping the dropdown.
|
|
55
|
+
*/
|
|
56
|
+
renderTrigger?: (props: UserDropdownRenderProps) => ReactNode;
|
|
57
|
+
};
|
|
25
58
|
/**
|
|
26
59
|
* UserDropdown component displays a user avatar with a dropdown menu.
|
|
27
60
|
* When clicked, it shows a popover with customizable menu items.
|
|
28
61
|
* This component is the React-specific implementation that uses the BaseUserDropdown
|
|
29
62
|
* and automatically retrieves the user data from Asgardeo context.
|
|
30
63
|
*
|
|
64
|
+
* Supports render props for complete customization of the dropdown appearance and behavior.
|
|
65
|
+
*
|
|
31
66
|
* @example
|
|
32
67
|
* ```tsx
|
|
33
68
|
* // Basic usage - will use user from Asgardeo context
|
|
@@ -39,10 +74,31 @@ export type UserDropdownProps = Omit<BaseUserDropdownProps, 'user'>;
|
|
|
39
74
|
*
|
|
40
75
|
* // With custom configuration
|
|
41
76
|
* <UserDropdown
|
|
42
|
-
*
|
|
77
|
+
* showTriggerLabel={true}
|
|
43
78
|
* avatarSize={40}
|
|
44
79
|
* fallback={<div>Please sign in</div>}
|
|
45
80
|
* />
|
|
81
|
+
*
|
|
82
|
+
* // Using render props for complete customization
|
|
83
|
+
* <UserDropdown>
|
|
84
|
+
* {({ user, isLoading, openProfile, signOut }) => (
|
|
85
|
+
* <div>
|
|
86
|
+
* <button onClick={openProfile}>
|
|
87
|
+
* {user?.name || 'Loading...'}
|
|
88
|
+
* </button>
|
|
89
|
+
* <button onClick={signOut}>Logout</button>
|
|
90
|
+
* </div>
|
|
91
|
+
* )}
|
|
92
|
+
* </UserDropdown>
|
|
93
|
+
*
|
|
94
|
+
* // Using partial render props
|
|
95
|
+
* <UserDropdown
|
|
96
|
+
* renderTrigger={({ user, openProfile }) => (
|
|
97
|
+
* <button onClick={openProfile} className="custom-trigger">
|
|
98
|
+
* Welcome, {user?.name}!
|
|
99
|
+
* </button>
|
|
100
|
+
* )}
|
|
101
|
+
* />
|
|
46
102
|
* ```
|
|
47
103
|
*/
|
|
48
104
|
declare const UserDropdown: FC<UserDropdownProps>;
|
|
@@ -15,28 +15,51 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { User } from '@asgardeo/browser';
|
|
18
19
|
import { FC, ReactElement } from 'react';
|
|
20
|
+
interface ExtendedFlatSchema {
|
|
21
|
+
path?: string;
|
|
22
|
+
schemaId?: string;
|
|
23
|
+
}
|
|
24
|
+
interface Schema extends ExtendedFlatSchema {
|
|
25
|
+
caseExact?: boolean;
|
|
26
|
+
description?: string;
|
|
27
|
+
displayName?: string;
|
|
28
|
+
displayOrder?: string;
|
|
29
|
+
multiValued?: boolean;
|
|
30
|
+
mutability?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
returned?: string;
|
|
34
|
+
subAttributes?: Schema[];
|
|
35
|
+
type?: string;
|
|
36
|
+
uniqueness?: string;
|
|
37
|
+
value?: any;
|
|
38
|
+
}
|
|
19
39
|
export interface BaseUserProfileProps {
|
|
20
|
-
fallback?: ReactElement;
|
|
21
|
-
className?: string;
|
|
22
|
-
cardLayout?: boolean;
|
|
23
|
-
user: any;
|
|
24
|
-
mode?: 'inline' | 'popup';
|
|
25
|
-
portalId?: string;
|
|
26
|
-
title?: string;
|
|
27
40
|
attributeMapping?: {
|
|
28
|
-
|
|
41
|
+
[key: string]: string | string[] | undefined;
|
|
29
42
|
firstName?: string | string[];
|
|
30
43
|
lastName?: string | string[];
|
|
44
|
+
picture?: string | string[];
|
|
31
45
|
username?: string | string[];
|
|
32
|
-
[key: string]: string | string[] | undefined;
|
|
33
46
|
};
|
|
47
|
+
cancelButtonText?: string;
|
|
48
|
+
cardLayout?: boolean;
|
|
49
|
+
className?: string;
|
|
34
50
|
editable?: boolean;
|
|
51
|
+
fallback?: ReactElement;
|
|
52
|
+
flattenedProfile?: User;
|
|
53
|
+
mode?: 'inline' | 'popup';
|
|
35
54
|
onChange?: (field: string, value: any) => void;
|
|
55
|
+
onOpenChange?: (open: boolean) => void;
|
|
36
56
|
onSubmit?: (data: any) => void;
|
|
37
|
-
saveButtonText?: string;
|
|
38
|
-
cancelButtonText?: string;
|
|
39
57
|
onUpdate?: (payload: any) => Promise<void>;
|
|
58
|
+
open?: boolean;
|
|
59
|
+
profile?: User;
|
|
60
|
+
saveButtonText?: string;
|
|
61
|
+
schemas?: Schema[];
|
|
62
|
+
title?: string;
|
|
40
63
|
}
|
|
41
64
|
declare const BaseUserProfile: FC<BaseUserProfileProps>;
|
|
42
65
|
export default BaseUserProfile;
|
|
@@ -21,7 +21,7 @@ import { BaseUserProfileProps } from './BaseUserProfile';
|
|
|
21
21
|
* Props for the UserProfile component.
|
|
22
22
|
* Extends BaseUserProfileProps but makes the user prop optional since it will be obtained from useAsgardeo
|
|
23
23
|
*/
|
|
24
|
-
export type UserProfileProps = Omit<BaseUserProfileProps, 'user'>;
|
|
24
|
+
export type UserProfileProps = Omit<BaseUserProfileProps, 'user' | 'profile' | 'flattenedProfile' | 'schemas'>;
|
|
25
25
|
/**
|
|
26
26
|
* UserProfile component displays the authenticated user's profile information in a
|
|
27
27
|
* structured and styled format. It shows user details such as display name, email,
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { HTMLAttributes, ReactNode, RefAttributes, ForwardRefExoticComponent } from 'react';
|
|
19
|
+
export type AlertVariant = 'success' | 'error' | 'warning' | 'info';
|
|
20
|
+
export interface AlertProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
/**
|
|
22
|
+
* The visual variant of the alert that determines color scheme and icon
|
|
23
|
+
*/
|
|
24
|
+
variant?: AlertVariant;
|
|
25
|
+
/**
|
|
26
|
+
* Whether to show the default icon for the variant
|
|
27
|
+
*/
|
|
28
|
+
showIcon?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Alert content
|
|
31
|
+
*/
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {
|
|
35
|
+
/**
|
|
36
|
+
* Title content
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
export interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {
|
|
41
|
+
/**
|
|
42
|
+
* Description content
|
|
43
|
+
*/
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Alert component that displays important information with different severity levels.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* <Alert variant="success" showIcon>
|
|
52
|
+
* <Alert.Title>Success! Your changes have been saved</Alert.Title>
|
|
53
|
+
* <Alert.Description>
|
|
54
|
+
* This is an alert with icon, title and description.
|
|
55
|
+
* </Alert.Description>
|
|
56
|
+
* </Alert>
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare const Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>>;
|
|
60
|
+
/**
|
|
61
|
+
* Alert title component.
|
|
62
|
+
*/
|
|
63
|
+
declare const AlertTitle: ForwardRefExoticComponent<AlertTitleProps & RefAttributes<HTMLHeadingElement>>;
|
|
64
|
+
/**
|
|
65
|
+
* Alert description component.
|
|
66
|
+
*/
|
|
67
|
+
declare const AlertDescription: ForwardRefExoticComponent<AlertDescriptionProps & RefAttributes<HTMLParagraphElement>>;
|
|
68
|
+
export interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {
|
|
69
|
+
Title: typeof AlertTitle;
|
|
70
|
+
Description: typeof AlertDescription;
|
|
71
|
+
}
|
|
72
|
+
declare const _default: AlertComponent;
|
|
73
|
+
export default _default;
|
|
74
|
+
export { Alert, AlertTitle, AlertDescription };
|
|
@@ -17,26 +17,39 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { FC } from 'react';
|
|
19
19
|
export interface AvatarProps {
|
|
20
|
-
/**
|
|
21
|
-
* The URL of the avatar image
|
|
22
|
-
*/
|
|
23
|
-
imageUrl?: string;
|
|
24
20
|
/**
|
|
25
21
|
* Alternative text for the avatar image
|
|
26
22
|
*/
|
|
27
23
|
alt?: string;
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* Background generation strategy
|
|
26
|
+
* - 'random': Generate background color based on ASCII values of the name
|
|
27
|
+
* - 'none': Use default theme background
|
|
28
|
+
* - string: Use custom background color
|
|
29
|
+
* @default 'random'
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
background?: 'random' | 'none' | string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional className for the avatar
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The URL of the avatar image
|
|
38
|
+
*/
|
|
39
|
+
imageUrl?: string;
|
|
32
40
|
/**
|
|
33
41
|
* The name to use for generating initials when no image is provided
|
|
34
42
|
*/
|
|
35
43
|
name?: string;
|
|
36
44
|
/**
|
|
37
|
-
*
|
|
45
|
+
* The size of the avatar in pixels
|
|
38
46
|
*/
|
|
39
|
-
|
|
47
|
+
size?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The variant of the avatar shape
|
|
50
|
+
* @default 'circular'
|
|
51
|
+
*/
|
|
52
|
+
variant?: 'circular' | 'square';
|
|
40
53
|
}
|
|
41
54
|
export declare const Avatar: FC<AvatarProps>;
|
|
42
55
|
export default Avatar;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
19
|
+
export type ButtonColor = 'primary' | 'secondary' | 'tertiary' | string;
|
|
20
|
+
export type ButtonVariant = 'solid' | 'outline' | 'text';
|
|
21
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
22
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {
|
|
23
|
+
/**
|
|
24
|
+
* The button color that determines the color scheme
|
|
25
|
+
*/
|
|
26
|
+
color?: ButtonColor;
|
|
27
|
+
/**
|
|
28
|
+
* The button variant that determines the visual style
|
|
29
|
+
*/
|
|
30
|
+
variant?: ButtonVariant;
|
|
31
|
+
/**
|
|
32
|
+
* The size of the button
|
|
33
|
+
*/
|
|
34
|
+
size?: ButtonSize;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the button should take the full width of its container
|
|
37
|
+
*/
|
|
38
|
+
fullWidth?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the button is in a loading state
|
|
41
|
+
*/
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Icon to display before the button text
|
|
45
|
+
*/
|
|
46
|
+
startIcon?: React.ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Icon to display after the button text
|
|
49
|
+
*/
|
|
50
|
+
endIcon?: React.ReactNode;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Button component with multiple variants and types.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```tsx
|
|
57
|
+
* // Primary solid button
|
|
58
|
+
* <Button color="primary" variant="solid">
|
|
59
|
+
* Click me
|
|
60
|
+
* </Button>
|
|
61
|
+
*
|
|
62
|
+
* // Secondary outline button
|
|
63
|
+
* <Button color="secondary" variant="outline" size="large">
|
|
64
|
+
* Cancel
|
|
65
|
+
* </Button>
|
|
66
|
+
*
|
|
67
|
+
* // Text button with loading state
|
|
68
|
+
* <Button color="tertiary" variant="text" loading>
|
|
69
|
+
* Loading...
|
|
70
|
+
* </Button>
|
|
71
|
+
*
|
|
72
|
+
* // Button with icons
|
|
73
|
+
* <Button
|
|
74
|
+
* color="primary"
|
|
75
|
+
* startIcon={<Icon />}
|
|
76
|
+
* endIcon={<Arrow />}
|
|
77
|
+
* >
|
|
78
|
+
* Save and Continue
|
|
79
|
+
* </Button>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
83
|
+
export default Button;
|