@patternfly/react-core 4.234.0 → 4.234.3
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/CHANGELOG.md +24 -0
- package/dist/esm/components/LoginPage/LoginFooterItem.d.ts +3 -3
- package/dist/esm/components/LoginPage/LoginForm.d.ts +18 -18
- package/dist/esm/components/LoginPage/LoginHeader.d.ts +1 -1
- package/dist/esm/components/LoginPage/LoginMainBody.d.ts +2 -2
- package/dist/esm/components/LoginPage/LoginMainFooter.d.ts +5 -5
- package/dist/esm/components/LoginPage/LoginMainFooterBandItem.d.ts +2 -2
- package/dist/esm/components/LoginPage/LoginMainFooterLinksItem.d.ts +5 -5
- package/dist/esm/components/LoginPage/LoginMainHeader.d.ts +6 -4
- package/dist/esm/components/LoginPage/LoginMainHeader.d.ts.map +1 -1
- package/dist/esm/components/LoginPage/LoginMainHeader.js +2 -1
- package/dist/esm/components/LoginPage/LoginMainHeader.js.map +1 -1
- package/dist/esm/components/LoginPage/LoginPage.d.ts +16 -14
- package/dist/esm/components/LoginPage/LoginPage.d.ts.map +1 -1
- package/dist/esm/components/LoginPage/LoginPage.js +2 -2
- package/dist/esm/components/LoginPage/LoginPage.js.map +1 -1
- package/dist/js/components/LoginPage/LoginFooterItem.d.ts +3 -3
- package/dist/js/components/LoginPage/LoginForm.d.ts +18 -18
- package/dist/js/components/LoginPage/LoginHeader.d.ts +1 -1
- package/dist/js/components/LoginPage/LoginMainBody.d.ts +2 -2
- package/dist/js/components/LoginPage/LoginMainFooter.d.ts +5 -5
- package/dist/js/components/LoginPage/LoginMainFooterBandItem.d.ts +2 -2
- package/dist/js/components/LoginPage/LoginMainFooterLinksItem.d.ts +5 -5
- package/dist/js/components/LoginPage/LoginMainHeader.d.ts +6 -4
- package/dist/js/components/LoginPage/LoginMainHeader.d.ts.map +1 -1
- package/dist/js/components/LoginPage/LoginMainHeader.js +2 -1
- package/dist/js/components/LoginPage/LoginMainHeader.js.map +1 -1
- package/dist/js/components/LoginPage/LoginPage.d.ts +16 -14
- package/dist/js/components/LoginPage/LoginPage.d.ts.map +1 -1
- package/dist/js/components/LoginPage/LoginPage.js +2 -2
- package/dist/js/components/LoginPage/LoginPage.js.map +1 -1
- package/dist/umd/react-core.css +29 -29
- package/dist/umd/react-core.js +4 -3
- package/dist/umd/react-core.min.css +127 -127
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +6 -6
- package/src/components/LoginPage/LoginFooterItem.tsx +3 -3
- package/src/components/LoginPage/LoginForm.tsx +18 -18
- package/src/components/LoginPage/LoginHeader.tsx +1 -1
- package/src/components/LoginPage/LoginMainBody.tsx +2 -2
- package/src/components/LoginPage/LoginMainFooter.tsx +5 -5
- package/src/components/LoginPage/LoginMainFooterBandItem.tsx +2 -2
- package/src/components/LoginPage/LoginMainFooterLinksItem.tsx +5 -5
- package/src/components/LoginPage/LoginMainHeader.tsx +8 -4
- package/src/components/LoginPage/LoginPage.tsx +18 -15
- package/src/components/LoginPage/examples/LoginPage.md +8 -0
- package/src/components/LoginPage/examples/LoginPageBasic.tsx +0 -1
- package/src/components/LoginPage/examples/LoginPageLanguageSelect.tsx +194 -0
- package/src/components/LoginPage/examples/LoginPageShowHidePassword.tsx +0 -1
- package/src/components/NotificationDrawer/examples/NotificationDrawer.md +3 -708
- package/src/components/NotificationDrawer/examples/NotificationDrawerBasic.tsx +185 -0
- package/src/components/NotificationDrawer/examples/NotificationDrawerGroups.tsx +337 -0
- package/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx +185 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.234.
|
|
3
|
+
"version": "4.234.3",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"generate": "node scripts/copyStyles.js"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@patternfly/react-icons": "^4.85.
|
|
54
|
-
"@patternfly/react-styles": "^4.84.
|
|
55
|
-
"@patternfly/react-tokens": "^4.86.
|
|
53
|
+
"@patternfly/react-icons": "^4.85.3",
|
|
54
|
+
"@patternfly/react-styles": "^4.84.3",
|
|
55
|
+
"@patternfly/react-tokens": "^4.86.3",
|
|
56
56
|
"focus-trap": "6.9.2",
|
|
57
57
|
"react-dropzone": "9.0.0",
|
|
58
58
|
"tippy.js": "5.1.2",
|
|
59
59
|
"tslib": "^2.0.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@patternfly/patternfly": "4.210.
|
|
62
|
+
"@patternfly/patternfly": "4.210.2",
|
|
63
63
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
64
64
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
65
65
|
"@rollup/plugin-replace": "^4.0.0",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"react": "^16.8.0 || ^17.0.0",
|
|
77
77
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "f996263c7d744850e33d19bacb6fd19d109dc1af"
|
|
80
80
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
3
|
export interface LoginFooterItemProps extends React.HTMLProps<HTMLAnchorElement> {
|
|
4
|
-
/** Content rendered inside the footer
|
|
4
|
+
/** Content rendered inside the footer link item */
|
|
5
5
|
children?: React.ReactNode;
|
|
6
|
-
/** Additional classes added to the
|
|
6
|
+
/** Additional classes added to the footer link item */
|
|
7
7
|
className?: string;
|
|
8
|
-
/** The URL of the
|
|
8
|
+
/** The URL of the footer link item */
|
|
9
9
|
href?: string;
|
|
10
10
|
/** Specifies where to open the linked document */
|
|
11
11
|
target?: string;
|
|
@@ -11,29 +11,29 @@ import EyeIcon from '@patternfly/react-icons/dist/esm/icons/eye-icon';
|
|
|
11
11
|
export interface LoginFormProps extends React.HTMLProps<HTMLFormElement> {
|
|
12
12
|
/** Flag to indicate if the first dropdown item should not gain initial focus */
|
|
13
13
|
noAutoFocus?: boolean;
|
|
14
|
-
/** Additional classes added to the
|
|
14
|
+
/** Additional classes added to the login main body's form */
|
|
15
15
|
className?: string;
|
|
16
|
-
/** Flag indicating the
|
|
16
|
+
/** Flag indicating the helper text is visible * */
|
|
17
17
|
showHelperText?: boolean;
|
|
18
|
-
/** Content displayed in the
|
|
18
|
+
/** Content displayed in the helper text component * */
|
|
19
19
|
helperText?: React.ReactNode;
|
|
20
|
-
/** Icon displayed to the left in the
|
|
20
|
+
/** Icon displayed to the left in the helper text */
|
|
21
21
|
helperTextIcon?: React.ReactNode;
|
|
22
|
-
/** Label for the
|
|
22
|
+
/** Label for the username input field */
|
|
23
23
|
usernameLabel?: string;
|
|
24
|
-
/** Value for the
|
|
24
|
+
/** Value for the username */
|
|
25
25
|
usernameValue?: string;
|
|
26
|
-
/** Function that handles the onChange event for the
|
|
26
|
+
/** Function that handles the onChange event for the username */
|
|
27
27
|
onChangeUsername?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
|
|
28
|
-
/** Flag indicating if the
|
|
28
|
+
/** Flag indicating if the username is valid */
|
|
29
29
|
isValidUsername?: boolean;
|
|
30
|
-
/** Label for the
|
|
30
|
+
/** Label for the password input field */
|
|
31
31
|
passwordLabel?: string;
|
|
32
|
-
/** Value for the
|
|
32
|
+
/** Value for the password */
|
|
33
33
|
passwordValue?: string;
|
|
34
|
-
/** Function that handles the onChange event for the
|
|
34
|
+
/** Function that handles the onChange event for the password */
|
|
35
35
|
onChangePassword?: (value: string, event: React.FormEvent<HTMLInputElement>) => void;
|
|
36
|
-
/** Flag indicating if the
|
|
36
|
+
/** Flag indicating if the password is valid */
|
|
37
37
|
isValidPassword?: boolean;
|
|
38
38
|
/** Flag indicating if the user can toggle hiding the password */
|
|
39
39
|
isShowPasswordEnabled?: boolean;
|
|
@@ -41,17 +41,17 @@ export interface LoginFormProps extends React.HTMLProps<HTMLFormElement> {
|
|
|
41
41
|
showPasswordAriaLabel?: string;
|
|
42
42
|
/** Accessible label for the hide password button */
|
|
43
43
|
hidePasswordAriaLabel?: string;
|
|
44
|
-
/** Label for the
|
|
44
|
+
/** Label for the log in button input */
|
|
45
45
|
loginButtonLabel?: string;
|
|
46
|
-
/** Flag indicating if the
|
|
46
|
+
/** Flag indicating if the login button is disabled */
|
|
47
47
|
isLoginButtonDisabled?: boolean;
|
|
48
|
-
/** Function that is called when the
|
|
48
|
+
/** Function that is called when the login button is clicked */
|
|
49
49
|
onLoginButtonClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
50
|
-
/** Label for the
|
|
50
|
+
/** Label for the remember me checkbox that indicates the user should be kept logged in. If the label is not provided, the checkbox will not show. */
|
|
51
51
|
rememberMeLabel?: string;
|
|
52
|
-
/** Flag indicating if the remember me
|
|
52
|
+
/** Flag indicating if the remember me checkbox is checked. */
|
|
53
53
|
isRememberMeChecked?: boolean;
|
|
54
|
-
/** Function that handles the onChange event for the
|
|
54
|
+
/** Function that handles the onChange event for the remember me checkbox */
|
|
55
55
|
onChangeRememberMe?: (checked: boolean, event: React.FormEvent<HTMLInputElement>) => void;
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -7,7 +7,7 @@ export interface LoginHeaderProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
/** Additional classes added to the login header */
|
|
9
9
|
className?: string;
|
|
10
|
-
/** Header
|
|
10
|
+
/** Header brand component (e.g. <LoginHeader />) */
|
|
11
11
|
headerBrand?: React.ReactNode;
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -3,9 +3,9 @@ import { css } from '@patternfly/react-styles';
|
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Login/login';
|
|
4
4
|
|
|
5
5
|
export interface LoginMainBodyProps extends React.HTMLProps<HTMLDivElement> {
|
|
6
|
-
/** Content rendered inside the
|
|
6
|
+
/** Content rendered inside the login main body */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
/** Additional classes added to the
|
|
8
|
+
/** Additional classes added to the login main body */
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -3,15 +3,15 @@ import { css } from '@patternfly/react-styles';
|
|
|
3
3
|
import styles from '@patternfly/react-styles/css/components/Login/login';
|
|
4
4
|
|
|
5
5
|
export interface LoginMainFooterProps extends React.HTMLProps<HTMLDivElement> {
|
|
6
|
-
/** Additional classes added to the
|
|
6
|
+
/** Additional classes added to the login main footer */
|
|
7
7
|
className?: string;
|
|
8
|
-
/** Content rendered inside the
|
|
8
|
+
/** Content rendered inside the login main footer */
|
|
9
9
|
children?: React.ReactNode;
|
|
10
|
-
/** Content rendered inside the
|
|
10
|
+
/** Content rendered inside the login main footer as social media links* */
|
|
11
11
|
socialMediaLoginContent?: React.ReactNode;
|
|
12
|
-
/** Content rendered inside of
|
|
12
|
+
/** Content rendered inside of login main footer band to display a sign up for account message */
|
|
13
13
|
signUpForAccountMessage?: React.ReactNode;
|
|
14
|
-
/** Content rendered inside of
|
|
14
|
+
/** Content rendered inside of login main footer band do display a forgot credentials link* */
|
|
15
15
|
forgotCredentials?: React.ReactNode;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -3,9 +3,9 @@ import styles from '@patternfly/react-styles/css/components/Login/login';
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
|
|
5
5
|
export interface LoginMainFooterBandItemProps extends React.HTMLProps<HTMLParagraphElement> {
|
|
6
|
-
/** Content rendered inside the footer
|
|
6
|
+
/** Content rendered inside the footer link item */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
/** Additional classes added to the
|
|
8
|
+
/** Additional classes added to the footer link item */
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -3,15 +3,15 @@ import styles from '@patternfly/react-styles/css/components/Login/login';
|
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
|
|
5
5
|
export interface LoginMainFooterLinksItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
6
|
-
/** Content rendered inside the footer
|
|
6
|
+
/** Content rendered inside the footer link item */
|
|
7
7
|
children?: React.ReactNode;
|
|
8
|
-
/** HREF for
|
|
8
|
+
/** HREF for footer link item */
|
|
9
9
|
href?: string;
|
|
10
|
-
/** Target for
|
|
10
|
+
/** Target for footer link item */
|
|
11
11
|
target?: string;
|
|
12
|
-
/** Additional classes added to the
|
|
12
|
+
/** Additional classes added to the footer link item */
|
|
13
13
|
className?: string;
|
|
14
|
-
/** Component used to render the
|
|
14
|
+
/** Component used to render the footer link item */
|
|
15
15
|
linkComponent?: React.ReactNode;
|
|
16
16
|
/** Props for the LinkComponent */
|
|
17
17
|
linkComponentProps?: any;
|
|
@@ -4,14 +4,16 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import styles from '@patternfly/react-styles/css/components/Login/login';
|
|
5
5
|
|
|
6
6
|
export interface LoginMainHeaderProps extends React.HTMLProps<HTMLDivElement> {
|
|
7
|
-
/** Content rendered inside the
|
|
7
|
+
/** Content rendered inside the login main header */
|
|
8
8
|
children?: React.ReactNode;
|
|
9
|
-
/** Additional classes added to the
|
|
9
|
+
/** Additional classes added to the login main header */
|
|
10
10
|
className?: string;
|
|
11
|
-
/** Title for the
|
|
11
|
+
/** Title for the login main header */
|
|
12
12
|
title?: string;
|
|
13
|
-
/** Subtitle that contains the
|
|
13
|
+
/** Subtitle that contains the text, URL, and URL text for the login main header */
|
|
14
14
|
subtitle?: string;
|
|
15
|
+
/** Actions that render for the login main header */
|
|
16
|
+
headerUtilities?: React.ReactNode;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export const LoginMainHeader: React.FunctionComponent<LoginMainHeaderProps> = ({
|
|
@@ -19,6 +21,7 @@ export const LoginMainHeader: React.FunctionComponent<LoginMainHeaderProps> = ({
|
|
|
19
21
|
className = '',
|
|
20
22
|
title = '',
|
|
21
23
|
subtitle = '',
|
|
24
|
+
headerUtilities = null,
|
|
22
25
|
...props
|
|
23
26
|
}: LoginMainHeaderProps) => (
|
|
24
27
|
<header className={css(styles.loginMainHeader, className)} {...props}>
|
|
@@ -28,6 +31,7 @@ export const LoginMainHeader: React.FunctionComponent<LoginMainHeaderProps> = ({
|
|
|
28
31
|
</Title>
|
|
29
32
|
)}
|
|
30
33
|
{subtitle && <p className={css(styles.loginMainHeaderDesc)}>{subtitle}</p>}
|
|
34
|
+
{headerUtilities && <div className={css(styles.loginMainHeaderUtilities)}>{headerUtilities}</div>}
|
|
31
35
|
{children}
|
|
32
36
|
</header>
|
|
33
37
|
);
|
|
@@ -13,33 +13,35 @@ import { LoginMainBody } from './LoginMainBody';
|
|
|
13
13
|
import { LoginMainFooter } from './LoginMainFooter';
|
|
14
14
|
|
|
15
15
|
export interface LoginPageProps extends React.HTMLProps<HTMLDivElement> {
|
|
16
|
-
/** Anything that can be rendered inside of the
|
|
16
|
+
/** Anything that can be rendered inside of the login page (e.g. <LoginPageForm>) */
|
|
17
17
|
children?: React.ReactNode;
|
|
18
|
-
/** Additional classes added to the
|
|
18
|
+
/** Additional classes added to the login page */
|
|
19
19
|
className?: string;
|
|
20
|
-
/** Attribute that specifies the URL of the brand image for the
|
|
20
|
+
/** Attribute that specifies the URL of the brand image for the login page */
|
|
21
21
|
brandImgSrc?: string;
|
|
22
|
-
/** Attribute that specifies the alt text of the brand image for the
|
|
22
|
+
/** Attribute that specifies the alt text of the brand image for the login page */
|
|
23
23
|
brandImgAlt?: string;
|
|
24
|
-
/** Attribute that specifies the URL of the background image for the
|
|
24
|
+
/** Attribute that specifies the URL of the background image for the login page */
|
|
25
25
|
backgroundImgSrc?: string | BackgroundImageSrcMap;
|
|
26
|
-
/** Attribute that specifies the alt text of the background image for the
|
|
26
|
+
/** Attribute that specifies the alt text of the background image for the login page */
|
|
27
27
|
backgroundImgAlt?: string;
|
|
28
|
-
/** Content rendered inside of the
|
|
28
|
+
/** Content rendered inside of the text component of the login page */
|
|
29
29
|
textContent?: string;
|
|
30
|
-
/** Items rendered inside of the
|
|
30
|
+
/** Items rendered inside of the footer list component of the login page */
|
|
31
31
|
footerListItems?: React.ReactNode;
|
|
32
|
-
/** Adds list variant styles for the
|
|
32
|
+
/** Adds list variant styles for the footer list component of the login page. The only current value is'inline' */
|
|
33
33
|
footerListVariants?: ListVariant.inline;
|
|
34
|
-
/** Title for the
|
|
34
|
+
/** Title for the login main body header of the login page */
|
|
35
35
|
loginTitle: string;
|
|
36
|
-
/** Subtitle for the
|
|
36
|
+
/** Subtitle for the login main body header of the login page */
|
|
37
37
|
loginSubtitle?: string;
|
|
38
|
-
/**
|
|
38
|
+
/** @beta Header utilities for the login main body header of the login page */
|
|
39
|
+
headerUtilities?: React.ReactNode;
|
|
40
|
+
/** Content rendered inside of login main footer band to display a sign up for account message */
|
|
39
41
|
signUpForAccountMessage?: React.ReactNode;
|
|
40
|
-
/** Content rendered inside of
|
|
42
|
+
/** Content rendered inside of login main footer band to display a forgot credentials link. */
|
|
41
43
|
forgotCredentials?: React.ReactNode;
|
|
42
|
-
/** Content rendered inside of
|
|
44
|
+
/** Content rendered inside of social media login footer section */
|
|
43
45
|
socialMediaLoginContent?: React.ReactNode;
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -55,6 +57,7 @@ export const LoginPage: React.FunctionComponent<LoginPageProps> = ({
|
|
|
55
57
|
footerListVariants,
|
|
56
58
|
loginTitle,
|
|
57
59
|
loginSubtitle,
|
|
60
|
+
headerUtilities,
|
|
58
61
|
signUpForAccountMessage = null,
|
|
59
62
|
forgotCredentials = null,
|
|
60
63
|
socialMediaLoginContent = null,
|
|
@@ -77,7 +80,7 @@ export const LoginPage: React.FunctionComponent<LoginPageProps> = ({
|
|
|
77
80
|
<React.Fragment>
|
|
78
81
|
{backgroundImgSrc && <BackgroundImage src={backgroundImgSrc} alt={backgroundImgAlt} />}
|
|
79
82
|
<Login header={Header} footer={Footer} className={css(className)} {...props}>
|
|
80
|
-
<LoginMainHeader title={loginTitle} subtitle={loginSubtitle} />
|
|
83
|
+
<LoginMainHeader title={loginTitle} subtitle={loginSubtitle} headerUtilities={headerUtilities} />
|
|
81
84
|
<LoginMainBody>{children}</LoginMainBody>
|
|
82
85
|
{(socialMediaLoginContent || forgotCredentials || signUpForAccountMessage) && (
|
|
83
86
|
<LoginMainFooter
|
|
@@ -29,3 +29,11 @@ import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclam
|
|
|
29
29
|
### Show/hide password
|
|
30
30
|
```ts file='./LoginPageShowHidePassword.tsx' isFullscreen
|
|
31
31
|
```
|
|
32
|
+
|
|
33
|
+
### Customizing the header utilities
|
|
34
|
+
|
|
35
|
+
`headerUtilities` is a prop that can be customized to allow components to be placed into the header of the login page, likely for the user to take an action. The following example demonstrates the use of a Select component to display a list a languages.
|
|
36
|
+
|
|
37
|
+
### With header utilities
|
|
38
|
+
```ts file='./LoginPageLanguageSelect.tsx' isFullscreen
|
|
39
|
+
```
|
|
@@ -129,7 +129,6 @@ export const SimpleLoginPage: React.FunctionComponent = () => {
|
|
|
129
129
|
brandImgSrc={brandImg2}
|
|
130
130
|
brandImgAlt="PatternFly logo"
|
|
131
131
|
backgroundImgSrc={images}
|
|
132
|
-
backgroundImgAlt="Images"
|
|
133
132
|
footerListItems={listItem}
|
|
134
133
|
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
135
134
|
loginTitle="Log in to your account"
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import brandImg2 from './brandImgColor2.svg';
|
|
3
|
+
import {
|
|
4
|
+
LoginFooterItem,
|
|
5
|
+
LoginForm,
|
|
6
|
+
LoginMainFooterBandItem,
|
|
7
|
+
LoginMainFooterLinksItem,
|
|
8
|
+
LoginPage,
|
|
9
|
+
ListItem,
|
|
10
|
+
ListVariant,
|
|
11
|
+
Select,
|
|
12
|
+
SelectOption,
|
|
13
|
+
SelectOptionObject
|
|
14
|
+
} from '@patternfly/react-core';
|
|
15
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
16
|
+
|
|
17
|
+
export const LoginPageLanguageSelect: React.FunctionComponent = () => {
|
|
18
|
+
const [showHelperText, setShowHelperText] = React.useState(false);
|
|
19
|
+
const [username, setUsername] = React.useState('');
|
|
20
|
+
const [isValidUsername, setIsValidUsername] = React.useState(true);
|
|
21
|
+
const [password, setPassword] = React.useState('');
|
|
22
|
+
const [isValidPassword, setIsValidPassword] = React.useState(true);
|
|
23
|
+
const [isRememberMeChecked, setIsRememberMeChecked] = React.useState(false);
|
|
24
|
+
const [isHeaderUtilsOpen, setIsHeaderUtilsOpen] = React.useState(false);
|
|
25
|
+
const [selectedHeaderUtils, setSelectedHeaderUtils] = React.useState<string | SelectOptionObject>('English');
|
|
26
|
+
|
|
27
|
+
/** i18n object is used to simulate i18n integration of native language translation */
|
|
28
|
+
const i18n = {
|
|
29
|
+
English: 'English',
|
|
30
|
+
Mandarin: '普通话',
|
|
31
|
+
Hindi: 'हिन्दी',
|
|
32
|
+
Spanish: 'Español',
|
|
33
|
+
Portuguese: 'Português',
|
|
34
|
+
Arabic: 'عربى',
|
|
35
|
+
Bengali: 'বাংলা'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const headerUtilsOptions = [
|
|
39
|
+
<SelectOption key={0} value={i18n.English} />,
|
|
40
|
+
<SelectOption key={1} value={i18n.Mandarin} />,
|
|
41
|
+
<SelectOption key={2} value={i18n.Hindi} />,
|
|
42
|
+
<SelectOption key={3} value={i18n.Spanish} />,
|
|
43
|
+
<SelectOption key={4} value={i18n.Portuguese} />,
|
|
44
|
+
<SelectOption key={5} value={i18n.Arabic} />,
|
|
45
|
+
<SelectOption key={6} value={i18n.Bengali} />
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const onHeaderUtilsToggle = (isExpanded: boolean) => {
|
|
49
|
+
setIsHeaderUtilsOpen(isExpanded);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onHeaderUtilsSelect = (
|
|
53
|
+
_event: React.MouseEvent<Element, MouseEvent> | React.ChangeEvent<Element>,
|
|
54
|
+
value: string | SelectOptionObject
|
|
55
|
+
) => {
|
|
56
|
+
setSelectedHeaderUtils(value);
|
|
57
|
+
setIsHeaderUtilsOpen(false);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const headerUtils = (
|
|
61
|
+
<Select
|
|
62
|
+
aria-label="Select Language"
|
|
63
|
+
onToggle={onHeaderUtilsToggle}
|
|
64
|
+
onSelect={onHeaderUtilsSelect}
|
|
65
|
+
selections={selectedHeaderUtils}
|
|
66
|
+
isOpen={isHeaderUtilsOpen}
|
|
67
|
+
>
|
|
68
|
+
{headerUtilsOptions}
|
|
69
|
+
</Select>
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
const handleUsernameChange = (value: string) => {
|
|
73
|
+
setUsername(value);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handlePasswordChange = (value: string) => {
|
|
77
|
+
setPassword(value);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const onRememberMeClick = () => {
|
|
81
|
+
setIsRememberMeChecked(!isRememberMeChecked);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const onLoginButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
setIsValidUsername(!!username);
|
|
87
|
+
setIsValidPassword(!!password);
|
|
88
|
+
setShowHelperText(!username || !password);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const socialMediaLoginContent = (
|
|
92
|
+
<React.Fragment>
|
|
93
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Google' }}>
|
|
94
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512">
|
|
95
|
+
<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
|
|
96
|
+
</svg>
|
|
97
|
+
</LoginMainFooterLinksItem>
|
|
98
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Github' }}>
|
|
99
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
|
|
100
|
+
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
|
|
101
|
+
</svg>
|
|
102
|
+
</LoginMainFooterLinksItem>
|
|
103
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Dropbox' }}>
|
|
104
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 512">
|
|
105
|
+
<path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z" />
|
|
106
|
+
</svg>
|
|
107
|
+
</LoginMainFooterLinksItem>
|
|
108
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
|
|
109
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
110
|
+
<path d="M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z" />
|
|
111
|
+
</svg>
|
|
112
|
+
</LoginMainFooterLinksItem>
|
|
113
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Gitlab' }}>
|
|
114
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
115
|
+
<path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z" />
|
|
116
|
+
</svg>
|
|
117
|
+
</LoginMainFooterLinksItem>
|
|
118
|
+
</React.Fragment>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
const signUpForAccountMessage = (
|
|
122
|
+
<LoginMainFooterBandItem>
|
|
123
|
+
Need an account? <a href="#">Sign up.</a>
|
|
124
|
+
</LoginMainFooterBandItem>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const forgotCredentials = (
|
|
128
|
+
<LoginMainFooterBandItem>
|
|
129
|
+
<a href="#">Forgot username or password?</a>
|
|
130
|
+
</LoginMainFooterBandItem>
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const listItem = (
|
|
134
|
+
<React.Fragment>
|
|
135
|
+
<ListItem>
|
|
136
|
+
<LoginFooterItem href="#">Terms of Use </LoginFooterItem>
|
|
137
|
+
</ListItem>
|
|
138
|
+
<ListItem>
|
|
139
|
+
<LoginFooterItem href="#">Help</LoginFooterItem>
|
|
140
|
+
</ListItem>
|
|
141
|
+
<ListItem>
|
|
142
|
+
<LoginFooterItem href="#">Privacy Policy</LoginFooterItem>
|
|
143
|
+
</ListItem>
|
|
144
|
+
</React.Fragment>
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const loginForm = (
|
|
148
|
+
<LoginForm
|
|
149
|
+
showHelperText={showHelperText}
|
|
150
|
+
helperText="Invalid login credentials."
|
|
151
|
+
helperTextIcon={<ExclamationCircleIcon />}
|
|
152
|
+
usernameLabel="Username"
|
|
153
|
+
usernameValue={username}
|
|
154
|
+
onChangeUsername={handleUsernameChange}
|
|
155
|
+
isValidUsername={isValidUsername}
|
|
156
|
+
passwordLabel="Password"
|
|
157
|
+
passwordValue={password}
|
|
158
|
+
onChangePassword={handlePasswordChange}
|
|
159
|
+
isValidPassword={isValidPassword}
|
|
160
|
+
rememberMeLabel="Keep me logged in for 30 days."
|
|
161
|
+
isRememberMeChecked={isRememberMeChecked}
|
|
162
|
+
onChangeRememberMe={onRememberMeClick}
|
|
163
|
+
onLoginButtonClick={onLoginButtonClick}
|
|
164
|
+
loginButtonLabel="Log in"
|
|
165
|
+
/>
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const images = {
|
|
169
|
+
lg: '/assets/images/pfbg_1200.jpg',
|
|
170
|
+
sm: '/assets/images/pfbg_768.jpg',
|
|
171
|
+
sm2x: '/assets/images/pfbg_768@2x.jpg',
|
|
172
|
+
xs: '/assets/images/pfbg_576.jpg',
|
|
173
|
+
xs2x: '/assets/images/pfbg_576@2x.jpg'
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<LoginPage
|
|
178
|
+
footerListVariants={ListVariant.inline}
|
|
179
|
+
brandImgSrc={brandImg2}
|
|
180
|
+
brandImgAlt="PatternFly logo"
|
|
181
|
+
backgroundImgSrc={images}
|
|
182
|
+
footerListItems={listItem}
|
|
183
|
+
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
184
|
+
loginTitle="Log in to your account"
|
|
185
|
+
loginSubtitle="Enter your single sign-on LDAP credentials."
|
|
186
|
+
headerUtilities={headerUtils}
|
|
187
|
+
socialMediaLoginContent={socialMediaLoginContent}
|
|
188
|
+
signUpForAccountMessage={signUpForAccountMessage}
|
|
189
|
+
forgotCredentials={forgotCredentials}
|
|
190
|
+
>
|
|
191
|
+
{loginForm}
|
|
192
|
+
</LoginPage>
|
|
193
|
+
);
|
|
194
|
+
};
|
|
@@ -130,7 +130,6 @@ export const LoginPageHideShowPassword: React.FunctionComponent = () => {
|
|
|
130
130
|
brandImgSrc={brandImg2}
|
|
131
131
|
brandImgAlt="PatternFly logo"
|
|
132
132
|
backgroundImgSrc={images}
|
|
133
|
-
backgroundImgAlt="Images"
|
|
134
133
|
footerListItems={listItem}
|
|
135
134
|
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
136
135
|
loginTitle="Log in to your account"
|