@patternfly/react-core 4.191.6 → 4.192.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 +38 -0
- package/dist/esm/components/DataList/DataListCheck.d.ts +1 -1
- package/dist/esm/components/DataList/DataListCheck.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts +2 -1
- package/dist/esm/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
- package/dist/esm/components/Modal/ModalBoxCloseButton.js +2 -2
- package/dist/esm/components/Modal/ModalBoxCloseButton.js.map +1 -1
- package/dist/esm/components/Modal/ModalContent.js +1 -1
- package/dist/esm/components/Modal/ModalContent.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts +2 -0
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectOption.js +70 -48
- package/dist/esm/components/Select/SelectOption.js.map +1 -1
- package/dist/esm/components/Truncate/Truncate.d.ts +21 -0
- package/dist/esm/components/Truncate/Truncate.d.ts.map +1 -0
- package/dist/esm/components/Truncate/Truncate.js +34 -0
- package/dist/esm/components/Truncate/Truncate.js.map +1 -0
- package/dist/esm/components/Truncate/index.d.ts +2 -0
- package/dist/esm/components/Truncate/index.d.ts.map +1 -0
- package/dist/esm/components/Truncate/index.js +2 -0
- package/dist/esm/components/Truncate/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/js/components/DataList/DataListCheck.d.ts +1 -1
- package/dist/js/components/DataList/DataListCheck.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxCloseButton.d.ts +2 -1
- package/dist/js/components/Modal/ModalBoxCloseButton.d.ts.map +1 -1
- package/dist/js/components/Modal/ModalBoxCloseButton.js +2 -2
- package/dist/js/components/Modal/ModalBoxCloseButton.js.map +1 -1
- package/dist/js/components/Modal/ModalContent.js +1 -1
- package/dist/js/components/Modal/ModalContent.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +2 -2
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts +2 -0
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/Select/SelectOption.js +70 -48
- package/dist/js/components/Select/SelectOption.js.map +1 -1
- package/dist/js/components/Truncate/Truncate.d.ts +21 -0
- package/dist/js/components/Truncate/Truncate.d.ts.map +1 -0
- package/dist/js/components/Truncate/Truncate.js +38 -0
- package/dist/js/components/Truncate/Truncate.js.map +1 -0
- package/dist/js/components/Truncate/index.d.ts +2 -0
- package/dist/js/components/Truncate/index.d.ts.map +1 -0
- package/dist/js/components/Truncate/index.js +5 -0
- package/dist/js/components/Truncate/index.js.map +1 -0
- package/dist/js/components/index.d.ts +1 -0
- package/dist/js/components/index.d.ts.map +1 -1
- package/dist/js/components/index.js +1 -0
- package/dist/js/components/index.js.map +1 -1
- package/dist/umd/react-core.css +59 -6
- package/dist/umd/react-core.js +1002 -940
- package/dist/umd/react-core.min.css +59 -6
- package/dist/umd/react-core.min.js +2 -2
- package/index.d.ts +4 -0
- package/package.json +6 -6
- package/src/components/BackToTop/examples/BackToTop.css +3 -3
- package/src/components/BackToTop/examples/BackToTop.md +2 -6
- package/src/components/BackToTop/examples/BackToTopBasic.tsx +4 -0
- package/src/components/Backdrop/examples/Backdrop.md +3 -12
- package/src/components/Backdrop/examples/BackdropBasic.tsx +4 -0
- package/src/components/Backdrop/examples/BackdropSpinner.tsx +10 -0
- package/src/components/BackgroundImage/examples/BackgroundImage.md +2 -21
- package/src/components/BackgroundImage/examples/BackgroundImageBasic.tsx +15 -0
- package/src/components/Badge/examples/Badge.md +3 -24
- package/src/components/Badge/examples/BadgeRead.tsx +19 -0
- package/src/components/Badge/examples/BadgeUnread.tsx +8 -0
- package/src/components/Banner/examples/Banner.md +1 -14
- package/src/components/Banner/examples/BannerBasic.tsx +16 -0
- package/src/components/Brand/examples/Brand.md +3 -5
- package/src/components/Brand/examples/BrandBasic.tsx +5 -0
- package/src/components/Breadcrumb/examples/Breadcrumb.md +4 -105
- package/src/components/Breadcrumb/examples/BreadcrumbBasic.tsx +13 -0
- package/src/components/Breadcrumb/examples/BreadcrumbDropdown.tsx +53 -0
- package/src/components/Breadcrumb/examples/BreadcrumbWithHeading.tsx +12 -0
- package/src/components/Breadcrumb/examples/BreadcrumbWithoutHomeLink.tsx +15 -0
- package/src/components/Button/examples/ButtonAriaDisabled.tsx +33 -37
- package/src/components/Button/examples/ButtonCallToAction.tsx +8 -6
- package/src/components/Button/examples/ButtonDisabled.tsx +33 -37
- package/src/components/Button/examples/ButtonInlineSpanLink.tsx +2 -2
- package/src/components/Button/examples/ButtonLinks.tsx +6 -6
- package/src/components/Button/examples/ButtonProgress.tsx +8 -5
- package/src/components/Button/examples/ButtonSmall.tsx +9 -7
- package/src/components/Button/examples/ButtonTypes.tsx +4 -6
- package/src/components/Button/examples/ButtonVariations.tsx +31 -36
- package/src/components/DataList/DataListCheck.tsx +1 -1
- package/src/components/Modal/ModalBoxCloseButton.tsx +11 -2
- package/src/components/Modal/ModalContent.tsx +1 -1
- package/src/components/Modal/examples/Modal.md +3 -200
- package/src/components/Modal/examples/ModalWithForm.tsx +209 -0
- package/src/components/Select/Select.tsx +2 -1
- package/src/components/Select/SelectOption.tsx +188 -133
- package/src/components/Truncate/Truncate.tsx +63 -0
- package/src/components/Truncate/__tests__/Truncate.test.tsx +18 -0
- package/src/components/Truncate/__tests__/__snapshots__/Truncate.test.tsx.snap +58 -0
- package/src/components/Truncate/examples/Truncate.md +59 -0
- package/src/components/Truncate/examples/TruncateExamples.css +9 -0
- package/src/components/Truncate/index.ts +1 -0
- package/src/components/index.ts +1 -0
- package/src/demos/Tabs/NestedTabsDemo.js +3 -3
- package/src/demos/Tabs.md +4 -0
- package/src/demos/examples/Tabs/GrayTabs.tsx +158 -0
|
@@ -1,43 +1,39 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
3
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
4
4
|
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
|
|
5
5
|
|
|
6
6
|
export const ButtonDisabled: React.FunctionComponent = () => (
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Control disabled
|
|
40
|
-
</Button>
|
|
41
|
-
</Flex>
|
|
42
|
-
</Flex>
|
|
7
|
+
<React.Fragment>
|
|
8
|
+
<Button isDisabled>Primary disabled</Button> <Button isDisabled>Secondary disabled</Button>{' '}
|
|
9
|
+
<Button variant="secondary" isDanger isDisabled>
|
|
10
|
+
Danger secondary disabled
|
|
11
|
+
</Button>{' '}
|
|
12
|
+
<Button isDisabled variant="tertiary">
|
|
13
|
+
Tertiary disabled
|
|
14
|
+
</Button>{' '}
|
|
15
|
+
<Button isDisabled variant="danger">
|
|
16
|
+
Danger disabled
|
|
17
|
+
</Button>{' '}
|
|
18
|
+
<Button isDisabled variant="warning">
|
|
19
|
+
Warning disabled
|
|
20
|
+
</Button>
|
|
21
|
+
<br />
|
|
22
|
+
<br />
|
|
23
|
+
<Button isDisabled variant="link" icon={<PlusCircleIcon />}>
|
|
24
|
+
Link disabled
|
|
25
|
+
</Button>{' '}
|
|
26
|
+
<Button isDisabled variant="link" isInline>
|
|
27
|
+
Inline link disabled
|
|
28
|
+
</Button>{' '}
|
|
29
|
+
<Button variant="link" isDanger isDisabled>
|
|
30
|
+
Danger link disabled
|
|
31
|
+
</Button>{' '}
|
|
32
|
+
<Button isDisabled variant="plain" aria-label="Action">
|
|
33
|
+
<TimesIcon />
|
|
34
|
+
</Button>{' '}
|
|
35
|
+
<Button isDisabled variant="control">
|
|
36
|
+
Control disabled
|
|
37
|
+
</Button>
|
|
38
|
+
</React.Fragment>
|
|
43
39
|
);
|
|
@@ -13,7 +13,7 @@ const handleKeydown = (event: React.KeyboardEvent<HTMLButtonElement>) => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export const ButtonInlineSpanLink: React.FunctionComponent = () => (
|
|
16
|
-
|
|
16
|
+
<React.Fragment>
|
|
17
17
|
<p>
|
|
18
18
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
|
|
19
19
|
<Button variant="link" isInline component="span">
|
|
@@ -32,5 +32,5 @@ export const ButtonInlineSpanLink: React.FunctionComponent = () => (
|
|
|
32
32
|
</Button>
|
|
33
33
|
Pressing the Enter or Space keys on the inline link as span above demonstrates this by triggering an alert.
|
|
34
34
|
</p>
|
|
35
|
-
|
|
35
|
+
</React.Fragment>
|
|
36
36
|
);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const ButtonLinks: React.FunctionComponent = () => (
|
|
5
|
-
<
|
|
5
|
+
<React.Fragment>
|
|
6
6
|
<Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="primary">
|
|
7
7
|
Link to core docs
|
|
8
|
-
</Button>
|
|
8
|
+
</Button>{' '}
|
|
9
9
|
<Button component="a" href="https://pf4.patternfly.org/" target="_blank" variant="secondary">
|
|
10
10
|
Secondary link to core docs
|
|
11
|
-
</Button>
|
|
11
|
+
</Button>{' '}
|
|
12
12
|
<Button isDisabled component="a" href="https://pf4.patternfly.org/" target="_blank" variant="tertiary">
|
|
13
13
|
Tertiary link to core docs
|
|
14
|
-
</Button>
|
|
14
|
+
</Button>{' '}
|
|
15
15
|
<Button component="a" href="https://pf4.patternfly.org/contribution/#modifiers" variant="link">
|
|
16
16
|
Jump to modifiers in contribution guidelines
|
|
17
17
|
</Button>
|
|
18
|
-
</
|
|
18
|
+
</React.Fragment>
|
|
19
19
|
);
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const ButtonProgress: React.FunctionComponent = () => {
|
|
5
5
|
const [isPrimaryLoading, setIsPrimaryLoading] = React.useState<boolean>(true);
|
|
6
6
|
const [isSecondaryLoading, setIsSecondaryLoading] = React.useState<boolean>(true);
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
|
-
<
|
|
9
|
+
<React.Fragment>
|
|
10
10
|
<Button
|
|
11
|
+
spinnerAriaValueText={isPrimaryLoading ? 'Loading' : undefined}
|
|
11
12
|
isLoading={isPrimaryLoading}
|
|
12
13
|
variant="primary"
|
|
13
14
|
onClick={() => setIsPrimaryLoading(!isPrimaryLoading)}
|
|
14
15
|
{...(isPrimaryLoading && { spinnerAriaValueText: 'Loading' })}
|
|
15
16
|
>
|
|
16
17
|
{isPrimaryLoading ? 'Click to stop loading' : 'Click to start loading'}
|
|
17
|
-
</Button>
|
|
18
|
-
|
|
18
|
+
</Button>{' '}
|
|
19
19
|
<Button
|
|
20
|
+
spinnerAriaValueText={isSecondaryLoading ? 'Loading' : undefined}
|
|
20
21
|
isLoading={isSecondaryLoading}
|
|
21
22
|
variant="secondary"
|
|
22
23
|
onClick={() => setIsSecondaryLoading(!isSecondaryLoading)}
|
|
@@ -24,6 +25,8 @@ export const ButtonProgress: React.FunctionComponent = () => {
|
|
|
24
25
|
>
|
|
25
26
|
{isSecondaryLoading ? 'Click to stop loading' : 'Click to start loading'}
|
|
26
27
|
</Button>
|
|
27
|
-
|
|
28
|
+
<br />
|
|
29
|
+
<br />
|
|
30
|
+
</React.Fragment>
|
|
28
31
|
);
|
|
29
32
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const ButtonSmall: React.FunctionComponent = () => (
|
|
5
|
-
<
|
|
5
|
+
<React.Fragment>
|
|
6
6
|
<Button variant="primary" isSmall>
|
|
7
7
|
Primary
|
|
8
|
-
</Button>
|
|
8
|
+
</Button>{' '}
|
|
9
9
|
<Button variant="secondary" isSmall>
|
|
10
10
|
Secondary
|
|
11
|
-
</Button>
|
|
11
|
+
</Button>{' '}
|
|
12
12
|
<Button variant="tertiary" isSmall>
|
|
13
13
|
Tertiary
|
|
14
|
-
</Button>
|
|
14
|
+
</Button>{' '}
|
|
15
15
|
<Button variant="danger" isSmall>
|
|
16
16
|
Danger
|
|
17
|
-
</Button>
|
|
17
|
+
</Button>{' '}
|
|
18
18
|
<Button variant="warning" isSmall>
|
|
19
19
|
Warning
|
|
20
20
|
</Button>
|
|
21
|
-
|
|
21
|
+
<br />
|
|
22
|
+
<br />
|
|
23
|
+
</React.Fragment>
|
|
22
24
|
);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
3
|
|
|
4
4
|
export const ButtonTypes: React.FunctionComponent = () => (
|
|
5
|
-
<
|
|
6
|
-
<Button type="submit">Submit</Button>
|
|
7
|
-
|
|
8
|
-
<Button>Default</Button>
|
|
9
|
-
</Flex>
|
|
5
|
+
<React.Fragment>
|
|
6
|
+
<Button type="submit">Submit</Button> <Button type="reset">Reset</Button> <Button>Default</Button>
|
|
7
|
+
</React.Fragment>
|
|
10
8
|
);
|
|
@@ -1,47 +1,42 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Button
|
|
2
|
+
import { Button } from '@patternfly/react-core';
|
|
3
3
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
4
4
|
import PlusCircleIcon from '@patternfly/react-icons/dist/esm/icons/plus-circle-icon';
|
|
5
5
|
import ExternalLinkSquareAltIcon from '@patternfly/react-icons/dist/esm/icons/external-link-square-alt-icon';
|
|
6
6
|
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
|
|
7
7
|
|
|
8
8
|
export const ButtonVariations: React.FunctionComponent = () => (
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Danger link
|
|
33
|
-
</Button>
|
|
34
|
-
</Flex>
|
|
35
|
-
|
|
9
|
+
<React.Fragment>
|
|
10
|
+
<Button variant="primary">Primary</Button> <Button variant="secondary">Secondary</Button>{' '}
|
|
11
|
+
<Button variant="secondary" isDanger>
|
|
12
|
+
Danger Secondary
|
|
13
|
+
</Button>{' '}
|
|
14
|
+
<Button variant="tertiary">Tertiary</Button> <Button variant="danger">Danger</Button>{' '}
|
|
15
|
+
<Button variant="warning">Warning</Button>
|
|
16
|
+
<br />
|
|
17
|
+
<br />
|
|
18
|
+
<Button variant="link" icon={<PlusCircleIcon />}>
|
|
19
|
+
Link
|
|
20
|
+
</Button>{' '}
|
|
21
|
+
<Button variant="link" icon={<ExternalLinkSquareAltIcon />} iconPosition="right">
|
|
22
|
+
Link
|
|
23
|
+
</Button>{' '}
|
|
24
|
+
<Button variant="link" isInline>
|
|
25
|
+
Inline link
|
|
26
|
+
</Button>{' '}
|
|
27
|
+
<Button variant="link" isDanger>
|
|
28
|
+
Danger link
|
|
29
|
+
</Button>
|
|
30
|
+
<br />
|
|
31
|
+
<br />
|
|
36
32
|
<Button variant="plain" aria-label="Action">
|
|
37
33
|
<TimesIcon />
|
|
38
34
|
</Button>
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
</Flex>
|
|
35
|
+
<br />
|
|
36
|
+
<br />
|
|
37
|
+
<Button variant="control">Control</Button>{' '}
|
|
38
|
+
<Button variant="control" aria-label="Copy">
|
|
39
|
+
<CopyIcon />
|
|
40
|
+
</Button>
|
|
41
|
+
</React.Fragment>
|
|
47
42
|
);
|
|
@@ -11,7 +11,7 @@ export interface DataListCheckProps extends Omit<React.HTMLProps<HTMLInputElemen
|
|
|
11
11
|
isDisabled?: boolean;
|
|
12
12
|
/** Flag to show if the DataList checkbox is checked */
|
|
13
13
|
isChecked?: boolean;
|
|
14
|
-
/**
|
|
14
|
+
/** Flag to set default value of DataList checkbox when it is uncontrolled by React state */
|
|
15
15
|
checked?: boolean;
|
|
16
16
|
/** A callback for when the DataList checkbox selection changes */
|
|
17
17
|
onChange?: (checked: boolean, event: React.FormEvent<HTMLInputElement>) => void;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Button } from '../Button';
|
|
3
3
|
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';
|
|
4
|
+
import { OUIAProps } from '../../helpers';
|
|
4
5
|
|
|
5
|
-
export interface ModalBoxCloseButtonProps {
|
|
6
|
+
export interface ModalBoxCloseButtonProps extends OUIAProps {
|
|
6
7
|
/** Additional classes added to the close button */
|
|
7
8
|
className?: string;
|
|
8
9
|
/** A callback for when the close button is clicked */
|
|
@@ -12,9 +13,17 @@ export interface ModalBoxCloseButtonProps {
|
|
|
12
13
|
export const ModalBoxCloseButton: React.FunctionComponent<ModalBoxCloseButtonProps> = ({
|
|
13
14
|
className = '',
|
|
14
15
|
onClose = () => undefined as any,
|
|
16
|
+
ouiaId,
|
|
15
17
|
...props
|
|
16
18
|
}: ModalBoxCloseButtonProps) => (
|
|
17
|
-
<Button
|
|
19
|
+
<Button
|
|
20
|
+
className={className}
|
|
21
|
+
variant="plain"
|
|
22
|
+
onClick={onClose}
|
|
23
|
+
aria-label="Close"
|
|
24
|
+
{...(ouiaId && { ouiaId: `${ouiaId}-${ModalBoxCloseButton.displayName}` })}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
18
27
|
<TimesIcon />
|
|
19
28
|
</Button>
|
|
20
29
|
);
|
|
@@ -162,7 +162,7 @@ export const ModalContent: React.FunctionComponent<ModalContentProps> = ({
|
|
|
162
162
|
aria-describedby={ariaDescribedby || (hasNoBodyWrapper ? null : descriptorId)}
|
|
163
163
|
{...getOUIAProps(ModalContent.displayName, ouiaId, ouiaSafe)}
|
|
164
164
|
>
|
|
165
|
-
{showClose && <ModalBoxCloseButton onClose={onClose} />}
|
|
165
|
+
{showClose && <ModalBoxCloseButton onClose={onClose} ouiaId={ouiaId} />}
|
|
166
166
|
{modalBoxHeader}
|
|
167
167
|
{modalBody}
|
|
168
168
|
{modalBoxFooter}
|
|
@@ -866,203 +866,6 @@ class HelpModal extends React.Component {
|
|
|
866
866
|
|
|
867
867
|
### With form
|
|
868
868
|
|
|
869
|
-
```
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
FormModal = () => {
|
|
874
|
-
const [isModalOpen, setModalOpen] = React.useState(false);
|
|
875
|
-
const [nameValue, setNameValue] = React.useState("");
|
|
876
|
-
const [emailValue, setEmailValue] = React.useState("");
|
|
877
|
-
const [addressValue, setAddressValue] = React.useState("");
|
|
878
|
-
|
|
879
|
-
handleModalToggle = () => {
|
|
880
|
-
setModalOpen(!isModalOpen);
|
|
881
|
-
};
|
|
882
|
-
|
|
883
|
-
handleNameInputChange = value => {
|
|
884
|
-
setNameValue(value);
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
handleEmailInputChange = value => {
|
|
888
|
-
setEmailValue(value);
|
|
889
|
-
};
|
|
890
|
-
handleAddressInputChange = value => {
|
|
891
|
-
setAddressValue(value);
|
|
892
|
-
};
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
return (
|
|
896
|
-
<React.Fragment>
|
|
897
|
-
<Button variant="primary" onClick={handleModalToggle}>
|
|
898
|
-
Show modal
|
|
899
|
-
</Button>
|
|
900
|
-
<Modal
|
|
901
|
-
variant={ModalVariant.small}
|
|
902
|
-
title="Create account"
|
|
903
|
-
description="Enter your personal information below to create an account."
|
|
904
|
-
isOpen={isModalOpen}
|
|
905
|
-
onClose={handleModalToggle}
|
|
906
|
-
actions={[
|
|
907
|
-
<Button key="create" variant="primary" form="modal-with-form-form" onClick={this.handleModalToggle}>
|
|
908
|
-
Confirm
|
|
909
|
-
</Button>,
|
|
910
|
-
<Button key="cancel" variant="link" onClick={this.handleModalToggle}>
|
|
911
|
-
Cancel
|
|
912
|
-
</Button>
|
|
913
|
-
]}
|
|
914
|
-
>
|
|
915
|
-
<Form id="modal-with-form-form">
|
|
916
|
-
<FormGroup
|
|
917
|
-
label="Name"
|
|
918
|
-
labelIcon={
|
|
919
|
-
<Popover
|
|
920
|
-
headerContent={
|
|
921
|
-
<div>
|
|
922
|
-
The
|
|
923
|
-
<a href="https://schema.org/name" target="_blank">
|
|
924
|
-
name
|
|
925
|
-
</a>
|
|
926
|
-
of a
|
|
927
|
-
<a href="https://schema.org/Person" target="_blank">
|
|
928
|
-
Person
|
|
929
|
-
</a>
|
|
930
|
-
</div>
|
|
931
|
-
}
|
|
932
|
-
bodyContent={
|
|
933
|
-
<div>
|
|
934
|
-
Often composed of
|
|
935
|
-
<a href="https://schema.org/givenName" target="_blank">
|
|
936
|
-
givenName
|
|
937
|
-
</a>
|
|
938
|
-
and
|
|
939
|
-
<a href="https://schema.org/familyName" target="_blank">
|
|
940
|
-
familyName
|
|
941
|
-
</a>
|
|
942
|
-
.
|
|
943
|
-
</div>
|
|
944
|
-
}
|
|
945
|
-
>
|
|
946
|
-
<button
|
|
947
|
-
type="button"
|
|
948
|
-
aria-label="More info for name field"
|
|
949
|
-
onClick={e => e.preventDefault()}
|
|
950
|
-
aria-describedby="modal-with-form-form-name"
|
|
951
|
-
className="pf-c-form__group-label-help"
|
|
952
|
-
>
|
|
953
|
-
<HelpIcon noVerticalAlign />
|
|
954
|
-
</button>
|
|
955
|
-
</Popover>
|
|
956
|
-
}
|
|
957
|
-
isRequired
|
|
958
|
-
fieldId="modal-with-form-form-name">
|
|
959
|
-
<TextInput
|
|
960
|
-
isRequired
|
|
961
|
-
type="email"
|
|
962
|
-
id="modal-with-form-form-name"
|
|
963
|
-
name="modal-with-form-form-name"
|
|
964
|
-
value={nameValue}
|
|
965
|
-
onChange={handleNameInputChange}
|
|
966
|
-
/>
|
|
967
|
-
</FormGroup>
|
|
968
|
-
<FormGroup
|
|
969
|
-
label="E-mail"
|
|
970
|
-
labelIcon={
|
|
971
|
-
<Popover
|
|
972
|
-
headerContent={
|
|
973
|
-
<div>
|
|
974
|
-
The
|
|
975
|
-
<a href="https://schema.org/email" target="_blank">
|
|
976
|
-
e-mail
|
|
977
|
-
</a>
|
|
978
|
-
of a
|
|
979
|
-
<a href="https://schema.org/Person" target="_blank">
|
|
980
|
-
person
|
|
981
|
-
</a>
|
|
982
|
-
</div>
|
|
983
|
-
}
|
|
984
|
-
bodyContent={
|
|
985
|
-
<div>
|
|
986
|
-
Valid
|
|
987
|
-
<a href="https://schema.org/email" target="_blank">
|
|
988
|
-
e-mail
|
|
989
|
-
</a>
|
|
990
|
-
address.
|
|
991
|
-
</div>
|
|
992
|
-
}
|
|
993
|
-
>
|
|
994
|
-
<button
|
|
995
|
-
type="button"
|
|
996
|
-
aria-label="More info for e-mail field"
|
|
997
|
-
onClick={e => e.preventDefault()}
|
|
998
|
-
aria-describedby="modal-with-form-form-email"
|
|
999
|
-
className="pf-c-form__group-label-help"
|
|
1000
|
-
>
|
|
1001
|
-
<HelpIcon noVerticalAlign />
|
|
1002
|
-
</button>
|
|
1003
|
-
</Popover>
|
|
1004
|
-
}
|
|
1005
|
-
isRequired
|
|
1006
|
-
fieldId="modal-with-form-form-email">
|
|
1007
|
-
<TextInput
|
|
1008
|
-
isRequired
|
|
1009
|
-
type="email"
|
|
1010
|
-
id="modal-with-form-form-email"
|
|
1011
|
-
name="modal-with-form-form-email"
|
|
1012
|
-
value={emailValue}
|
|
1013
|
-
onChange={handleEmailInputChange}
|
|
1014
|
-
/>
|
|
1015
|
-
</FormGroup>
|
|
1016
|
-
<FormGroup
|
|
1017
|
-
label="Address"
|
|
1018
|
-
labelIcon={
|
|
1019
|
-
<Popover
|
|
1020
|
-
headerContent={
|
|
1021
|
-
<div>
|
|
1022
|
-
The
|
|
1023
|
-
<a href="https://schema.org/address" target="_blank">
|
|
1024
|
-
adress
|
|
1025
|
-
</a>
|
|
1026
|
-
of a
|
|
1027
|
-
<a href="https://schema.org/Person" target="_blank">
|
|
1028
|
-
person
|
|
1029
|
-
</a>
|
|
1030
|
-
</div>
|
|
1031
|
-
}
|
|
1032
|
-
bodyContent={
|
|
1033
|
-
<div>
|
|
1034
|
-
Valid
|
|
1035
|
-
<a href="https://schema.org/PostalAddress" target="_blank">
|
|
1036
|
-
postal address.
|
|
1037
|
-
</a>
|
|
1038
|
-
</div>
|
|
1039
|
-
}
|
|
1040
|
-
>
|
|
1041
|
-
<button
|
|
1042
|
-
type="button"
|
|
1043
|
-
aria-label="More info for address field"
|
|
1044
|
-
onClick={e => e.preventDefault()}
|
|
1045
|
-
aria-describedby="modal-with-form-form-address"
|
|
1046
|
-
className="pf-c-form__group-label-help"
|
|
1047
|
-
>
|
|
1048
|
-
<HelpIcon noVerticalAlign />
|
|
1049
|
-
</button>
|
|
1050
|
-
</Popover>
|
|
1051
|
-
}
|
|
1052
|
-
isRequired
|
|
1053
|
-
fieldId="modal-with-form-form-address">
|
|
1054
|
-
<TextInput
|
|
1055
|
-
isRequired
|
|
1056
|
-
type="email"
|
|
1057
|
-
id="modal-with-form-form-address"
|
|
1058
|
-
name="modal-with-form-form-address"
|
|
1059
|
-
value={addressValue}
|
|
1060
|
-
onChange={handleAddressInputChange}
|
|
1061
|
-
/>
|
|
1062
|
-
</FormGroup>
|
|
1063
|
-
</Form>
|
|
1064
|
-
</Modal>
|
|
1065
|
-
</React.Fragment>
|
|
1066
|
-
);
|
|
1067
|
-
};
|
|
1068
|
-
```
|
|
869
|
+
```ts file="ModalWithForm.tsx"
|
|
870
|
+
|
|
871
|
+
```
|