@patternfly/react-core 4.191.4 → 4.192.1
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/TextInputGroup/TextInputGroupMain.d.ts +4 -0
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.js +2 -2
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.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/TextInputGroup/TextInputGroupMain.d.ts +4 -0
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.js +2 -2
- package/dist/js/components/TextInputGroup/TextInputGroupMain.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 +943 -903
- package/dist/umd/react-core.min.css +59 -6
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +6 -6
- package/src/components/BackToTop/examples/BackToTop.md +1 -1
- 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/TextInputGroup/TextInputGroupMain.tsx +7 -1
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +6 -0
- package/src/components/TextInputGroup/examples/TextInputGroupFilters.tsx +12 -7
- package/src/components/TextInputGroup/examples/TextInputGroupUtilitiesAndIcon.tsx +12 -7
- 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
- package/src/demos/examples/TextInputGroup/AttributeValueFiltering.tsx +13 -8
- package/src/demos/examples/TextInputGroup/AutoCompleteSearch.tsx +29 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.192.1",
|
|
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",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.
|
|
38
|
-
"@patternfly/react-styles": "^4.
|
|
39
|
-
"@patternfly/react-tokens": "^4.
|
|
37
|
+
"@patternfly/react-icons": "^4.43.1",
|
|
38
|
+
"@patternfly/react-styles": "^4.42.1",
|
|
39
|
+
"@patternfly/react-tokens": "^4.44.1",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.171.0",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "fc2a4051cf86fd9f4ee94594265c53111177bf87"
|
|
64
64
|
}
|
|
@@ -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
|
+
```
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, ModalVariant, Button, Form, FormGroup, Popover, TextInput } from '@patternfly/react-core';
|
|
3
|
+
import HelpIcon from '@patternfly/react-icons/dist/esm/icons/help-icon';
|
|
4
|
+
|
|
5
|
+
export const ModalWithForm: React.FunctionComponent = () => {
|
|
6
|
+
const [isModalOpen, setModalOpen] = React.useState(false);
|
|
7
|
+
const [nameValue, setNameValue] = React.useState('');
|
|
8
|
+
const [emailValue, setEmailValue] = React.useState('');
|
|
9
|
+
const [addressValue, setAddressValue] = React.useState('');
|
|
10
|
+
const nameInputRef = React.useRef();
|
|
11
|
+
|
|
12
|
+
const handleModalToggle = () => {
|
|
13
|
+
setModalOpen(!isModalOpen);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const handleNameInputChange = value => {
|
|
17
|
+
setNameValue(value);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const handleEmailInputChange = value => {
|
|
21
|
+
setEmailValue(value);
|
|
22
|
+
};
|
|
23
|
+
const handleAddressInputChange = value => {
|
|
24
|
+
setAddressValue(value);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
React.useEffect(() => {
|
|
28
|
+
if (isModalOpen && nameInputRef && nameInputRef.current) {
|
|
29
|
+
(nameInputRef.current as HTMLInputElement).focus();
|
|
30
|
+
}
|
|
31
|
+
}, [isModalOpen]);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<React.Fragment>
|
|
35
|
+
<Button variant="primary" onClick={handleModalToggle}>
|
|
36
|
+
Show modal
|
|
37
|
+
</Button>
|
|
38
|
+
<Modal
|
|
39
|
+
variant={ModalVariant.small}
|
|
40
|
+
title="Create account"
|
|
41
|
+
description="Enter your personal information below to create an account."
|
|
42
|
+
isOpen={isModalOpen}
|
|
43
|
+
onClose={handleModalToggle}
|
|
44
|
+
actions={[
|
|
45
|
+
<Button key="create" variant="primary" form="modal-with-form-form" onClick={handleModalToggle}>
|
|
46
|
+
Confirm
|
|
47
|
+
</Button>,
|
|
48
|
+
<Button key="cancel" variant="link" onClick={handleModalToggle}>
|
|
49
|
+
Cancel
|
|
50
|
+
</Button>
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
53
|
+
<Form id="modal-with-form-form">
|
|
54
|
+
<FormGroup
|
|
55
|
+
label="Name"
|
|
56
|
+
labelIcon={
|
|
57
|
+
<Popover
|
|
58
|
+
headerContent={
|
|
59
|
+
<div>
|
|
60
|
+
The
|
|
61
|
+
<a href="https://schema.org/name" target="_blank" rel="noopener noreferrer">
|
|
62
|
+
name
|
|
63
|
+
</a>
|
|
64
|
+
of a
|
|
65
|
+
<a href="https://schema.org/Person" target="_blank" rel="noopener noreferrer">
|
|
66
|
+
Person
|
|
67
|
+
</a>
|
|
68
|
+
</div>
|
|
69
|
+
}
|
|
70
|
+
bodyContent={
|
|
71
|
+
<div>
|
|
72
|
+
Often composed of
|
|
73
|
+
<a href="https://schema.org/givenName" target="_blank" rel="noopener noreferrer">
|
|
74
|
+
givenName
|
|
75
|
+
</a>
|
|
76
|
+
and
|
|
77
|
+
<a href="https://schema.org/familyName" target="_blank" rel="noopener noreferrer">
|
|
78
|
+
familyName
|
|
79
|
+
</a>
|
|
80
|
+
.
|
|
81
|
+
</div>
|
|
82
|
+
}
|
|
83
|
+
>
|
|
84
|
+
<button
|
|
85
|
+
type="button"
|
|
86
|
+
aria-label="More info for name field"
|
|
87
|
+
onClick={e => e.preventDefault()}
|
|
88
|
+
aria-describedby="modal-with-form-form-name"
|
|
89
|
+
className="pf-c-form__group-label-help"
|
|
90
|
+
>
|
|
91
|
+
<HelpIcon noVerticalAlign />
|
|
92
|
+
</button>
|
|
93
|
+
</Popover>
|
|
94
|
+
}
|
|
95
|
+
isRequired
|
|
96
|
+
fieldId="modal-with-form-form-name"
|
|
97
|
+
>
|
|
98
|
+
<TextInput
|
|
99
|
+
isRequired
|
|
100
|
+
type="email"
|
|
101
|
+
id="modal-with-form-form-name"
|
|
102
|
+
name="modal-with-form-form-name"
|
|
103
|
+
value={nameValue}
|
|
104
|
+
onChange={handleNameInputChange}
|
|
105
|
+
ref={nameInputRef}
|
|
106
|
+
/>
|
|
107
|
+
</FormGroup>
|
|
108
|
+
<FormGroup
|
|
109
|
+
label="E-mail"
|
|
110
|
+
labelIcon={
|
|
111
|
+
<Popover
|
|
112
|
+
headerContent={
|
|
113
|
+
<div>
|
|
114
|
+
The
|
|
115
|
+
<a href="https://schema.org/email" target="_blank" rel="noopener noreferrer">
|
|
116
|
+
e-mail
|
|
117
|
+
</a>
|
|
118
|
+
of a
|
|
119
|
+
<a href="https://schema.org/Person" target="_blank" rel="noopener noreferrer">
|
|
120
|
+
person
|
|
121
|
+
</a>
|
|
122
|
+
</div>
|
|
123
|
+
}
|
|
124
|
+
bodyContent={
|
|
125
|
+
<div>
|
|
126
|
+
Valid
|
|
127
|
+
<a href="https://schema.org/email" target="_blank" rel="noopener noreferrer">
|
|
128
|
+
e-mail
|
|
129
|
+
</a>
|
|
130
|
+
address.
|
|
131
|
+
</div>
|
|
132
|
+
}
|
|
133
|
+
>
|
|
134
|
+
<button
|
|
135
|
+
type="button"
|
|
136
|
+
aria-label="More info for e-mail field"
|
|
137
|
+
onClick={e => e.preventDefault()}
|
|
138
|
+
aria-describedby="modal-with-form-form-email"
|
|
139
|
+
className="pf-c-form__group-label-help"
|
|
140
|
+
>
|
|
141
|
+
<HelpIcon noVerticalAlign />
|
|
142
|
+
</button>
|
|
143
|
+
</Popover>
|
|
144
|
+
}
|
|
145
|
+
isRequired
|
|
146
|
+
fieldId="modal-with-form-form-email"
|
|
147
|
+
>
|
|
148
|
+
<TextInput
|
|
149
|
+
isRequired
|
|
150
|
+
type="email"
|
|
151
|
+
id="modal-with-form-form-email"
|
|
152
|
+
name="modal-with-form-form-email"
|
|
153
|
+
value={emailValue}
|
|
154
|
+
onChange={handleEmailInputChange}
|
|
155
|
+
/>
|
|
156
|
+
</FormGroup>
|
|
157
|
+
<FormGroup
|
|
158
|
+
label="Address"
|
|
159
|
+
labelIcon={
|
|
160
|
+
<Popover
|
|
161
|
+
headerContent={
|
|
162
|
+
<div>
|
|
163
|
+
The
|
|
164
|
+
<a href="https://schema.org/address" target="_blank" rel="noopener noreferrer">
|
|
165
|
+
adress
|
|
166
|
+
</a>
|
|
167
|
+
of a
|
|
168
|
+
<a href="https://schema.org/Person" target="_blank" rel="noopener noreferrer">
|
|
169
|
+
person
|
|
170
|
+
</a>
|
|
171
|
+
</div>
|
|
172
|
+
}
|
|
173
|
+
bodyContent={
|
|
174
|
+
<div>
|
|
175
|
+
Valid
|
|
176
|
+
<a href="https://schema.org/PostalAddress" target="_blank" rel="noopener noreferrer">
|
|
177
|
+
postal address.
|
|
178
|
+
</a>
|
|
179
|
+
</div>
|
|
180
|
+
}
|
|
181
|
+
>
|
|
182
|
+
<button
|
|
183
|
+
type="button"
|
|
184
|
+
aria-label="More info for address field"
|
|
185
|
+
onClick={e => e.preventDefault()}
|
|
186
|
+
aria-describedby="modal-with-form-form-address"
|
|
187
|
+
className="pf-c-form__group-label-help"
|
|
188
|
+
>
|
|
189
|
+
<HelpIcon noVerticalAlign />
|
|
190
|
+
</button>
|
|
191
|
+
</Popover>
|
|
192
|
+
}
|
|
193
|
+
isRequired
|
|
194
|
+
fieldId="modal-with-form-form-address"
|
|
195
|
+
>
|
|
196
|
+
<TextInput
|
|
197
|
+
isRequired
|
|
198
|
+
type="email"
|
|
199
|
+
id="modal-with-form-form-address"
|
|
200
|
+
name="modal-with-form-form-address"
|
|
201
|
+
value={addressValue}
|
|
202
|
+
onChange={handleAddressInputChange}
|
|
203
|
+
/>
|
|
204
|
+
</FormGroup>
|
|
205
|
+
</Form>
|
|
206
|
+
</Modal>
|
|
207
|
+
</React.Fragment>
|
|
208
|
+
);
|
|
209
|
+
};
|
|
@@ -31,6 +31,10 @@ export interface TextInputGroupMainProps extends Omit<React.HTMLProps<HTMLDivEle
|
|
|
31
31
|
onBlur?: (event?: any) => void;
|
|
32
32
|
/** Accessibility label for the input */
|
|
33
33
|
'aria-label'?: string;
|
|
34
|
+
/** Value for the input */
|
|
35
|
+
value?: string | number;
|
|
36
|
+
/** Placeholder value for the input */
|
|
37
|
+
placeholder?: string;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps> = ({
|
|
@@ -43,6 +47,7 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
|
|
|
43
47
|
onBlur,
|
|
44
48
|
'aria-label': ariaLabel = 'Type to filter',
|
|
45
49
|
value: inputValue,
|
|
50
|
+
placeholder: inputPlaceHolder,
|
|
46
51
|
...props
|
|
47
52
|
}: TextInputGroupMainProps) => {
|
|
48
53
|
const { isDisabled } = React.useContext(TextInputGroupContext);
|
|
@@ -64,7 +69,8 @@ export const TextInputGroupMain: React.FunctionComponent<TextInputGroupMainProps
|
|
|
64
69
|
onChange={handleChange}
|
|
65
70
|
onFocus={onFocus}
|
|
66
71
|
onBlur={onBlur}
|
|
67
|
-
value={inputValue}
|
|
72
|
+
value={inputValue || ''}
|
|
73
|
+
placeholder={inputPlaceHolder}
|
|
68
74
|
/>
|
|
69
75
|
</span>
|
|
70
76
|
</div>
|
|
@@ -22,6 +22,7 @@ exports[`TextInputGroup gets custom class and id 1`] = `
|
|
|
22
22
|
className="pf-c-text-input-group__text-input"
|
|
23
23
|
onChange={[Function]}
|
|
24
24
|
type="text"
|
|
25
|
+
value=""
|
|
25
26
|
/>
|
|
26
27
|
</span>
|
|
27
28
|
</div>
|
|
@@ -53,6 +54,7 @@ exports[`TextInputGroup renders content 1`] = `
|
|
|
53
54
|
className="pf-c-text-input-group__text-input"
|
|
54
55
|
onChange={[Function]}
|
|
55
56
|
type="text"
|
|
57
|
+
value=""
|
|
56
58
|
/>
|
|
57
59
|
</span>
|
|
58
60
|
</div>
|
|
@@ -87,6 +89,7 @@ exports[`TextInputGroup renders with the proper stying when disabled 1`] = `
|
|
|
87
89
|
disabled={true}
|
|
88
90
|
onChange={[Function]}
|
|
89
91
|
type="text"
|
|
92
|
+
value=""
|
|
90
93
|
/>
|
|
91
94
|
</span>
|
|
92
95
|
</div>
|
|
@@ -115,6 +118,7 @@ exports[`TextInputGroupMain renders content 1`] = `
|
|
|
115
118
|
disabled={false}
|
|
116
119
|
onChange={[Function]}
|
|
117
120
|
type="text"
|
|
121
|
+
value=""
|
|
118
122
|
/>
|
|
119
123
|
</span>
|
|
120
124
|
</div>
|
|
@@ -172,6 +176,7 @@ exports[`TextInputGroupMain renders given input icon props 1`] = `
|
|
|
172
176
|
disabled={false}
|
|
173
177
|
onChange={[Function]}
|
|
174
178
|
type="text"
|
|
179
|
+
value=""
|
|
175
180
|
/>
|
|
176
181
|
</span>
|
|
177
182
|
</div>
|
|
@@ -195,6 +200,7 @@ exports[`TextInputGroupMain renders the input with custom aria label when given
|
|
|
195
200
|
disabled={false}
|
|
196
201
|
onChange={[Function]}
|
|
197
202
|
type="text"
|
|
203
|
+
value=""
|
|
198
204
|
/>
|
|
199
205
|
</span>
|
|
200
206
|
</div>
|
|
@@ -40,6 +40,9 @@ export const TextInputGroupFilters: React.FunctionComponent = () => {
|
|
|
40
40
|
/** show the input/chip clearing button only when either the text input or chip group are not empty */
|
|
41
41
|
const showClearButton = !!inputValue || !!currentChips.length;
|
|
42
42
|
|
|
43
|
+
/** render the utilities component only when a component it contains is being rendered */
|
|
44
|
+
const showUtilities = showClearButton;
|
|
45
|
+
|
|
43
46
|
/** callback for clearing all selected chips and the text input */
|
|
44
47
|
const clearChipsAndInput = () => {
|
|
45
48
|
setCurrentChips([]);
|
|
@@ -57,13 +60,15 @@ export const TextInputGroupFilters: React.FunctionComponent = () => {
|
|
|
57
60
|
))}
|
|
58
61
|
</ChipGroup>
|
|
59
62
|
</TextInputGroupMain>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
{showUtilities && (
|
|
64
|
+
<TextInputGroupUtilities>
|
|
65
|
+
{showClearButton && (
|
|
66
|
+
<Button variant="plain" onClick={clearChipsAndInput} aria-label="Clear button and input">
|
|
67
|
+
<TimesIcon />
|
|
68
|
+
</Button>
|
|
69
|
+
)}
|
|
70
|
+
</TextInputGroupUtilities>
|
|
71
|
+
)}
|
|
67
72
|
</TextInputGroup>
|
|
68
73
|
);
|
|
69
74
|
};
|
|
@@ -14,6 +14,9 @@ export const TextInputGroupUtilitiesAndIcon: React.FunctionComponent = () => {
|
|
|
14
14
|
/** show the input clearing button only when the input is not empty */
|
|
15
15
|
const showClearButton = !!inputValue;
|
|
16
16
|
|
|
17
|
+
/** render the utilities component only when a component it contains is being rendered */
|
|
18
|
+
const showUtilities = showClearButton;
|
|
19
|
+
|
|
17
20
|
/** callback for clearing the text input */
|
|
18
21
|
const clearInput = () => {
|
|
19
22
|
setInputValue('');
|
|
@@ -22,13 +25,15 @@ export const TextInputGroupUtilitiesAndIcon: React.FunctionComponent = () => {
|
|
|
22
25
|
return (
|
|
23
26
|
<TextInputGroup>
|
|
24
27
|
<TextInputGroupMain icon={<SearchIcon />} value={inputValue} onChange={handleInputChange} />
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
{showUtilities && (
|
|
29
|
+
<TextInputGroupUtilities>
|
|
30
|
+
{showClearButton && (
|
|
31
|
+
<Button variant="plain" onClick={clearInput} aria-label="Clear button and input">
|
|
32
|
+
<TimesIcon />
|
|
33
|
+
</Button>
|
|
34
|
+
)}
|
|
35
|
+
</TextInputGroupUtilities>
|
|
36
|
+
)}
|
|
32
37
|
</TextInputGroup>
|
|
33
38
|
);
|
|
34
39
|
};
|