@patternfly/react-core 4.199.3 → 4.200.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/Avatar/Avatar.d.ts +2 -0
  3. package/dist/esm/components/Avatar/Avatar.d.ts.map +1 -1
  4. package/dist/esm/components/Avatar/Avatar.js +2 -2
  5. package/dist/esm/components/Avatar/Avatar.js.map +1 -1
  6. package/dist/esm/components/FormSelect/FormSelect.d.ts +2 -0
  7. package/dist/esm/components/FormSelect/FormSelect.d.ts.map +1 -1
  8. package/dist/esm/components/FormSelect/FormSelect.js +3 -2
  9. package/dist/esm/components/FormSelect/FormSelect.js.map +1 -1
  10. package/dist/esm/components/TextArea/TextArea.d.ts +2 -0
  11. package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
  12. package/dist/esm/components/TextArea/TextArea.js +4 -3
  13. package/dist/esm/components/TextArea/TextArea.js.map +1 -1
  14. package/dist/esm/components/TextInput/TextInput.d.ts +2 -0
  15. package/dist/esm/components/TextInput/TextInput.d.ts.map +1 -1
  16. package/dist/esm/components/TextInput/TextInput.js +3 -2
  17. package/dist/esm/components/TextInput/TextInput.js.map +1 -1
  18. package/dist/js/components/Avatar/Avatar.d.ts +2 -0
  19. package/dist/js/components/Avatar/Avatar.d.ts.map +1 -1
  20. package/dist/js/components/Avatar/Avatar.js +2 -2
  21. package/dist/js/components/Avatar/Avatar.js.map +1 -1
  22. package/dist/js/components/FormSelect/FormSelect.d.ts +2 -0
  23. package/dist/js/components/FormSelect/FormSelect.d.ts.map +1 -1
  24. package/dist/js/components/FormSelect/FormSelect.js +3 -2
  25. package/dist/js/components/FormSelect/FormSelect.js.map +1 -1
  26. package/dist/js/components/TextArea/TextArea.d.ts +2 -0
  27. package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
  28. package/dist/js/components/TextArea/TextArea.js +4 -3
  29. package/dist/js/components/TextArea/TextArea.js.map +1 -1
  30. package/dist/js/components/TextInput/TextInput.d.ts +2 -0
  31. package/dist/js/components/TextInput/TextInput.d.ts.map +1 -1
  32. package/dist/js/components/TextInput/TextInput.js +3 -2
  33. package/dist/js/components/TextInput/TextInput.js.map +1 -1
  34. package/dist/umd/react-core.css +769 -769
  35. package/dist/umd/react-core.js +12 -9
  36. package/dist/umd/react-core.min.css +2 -2
  37. package/dist/umd/react-core.min.js +2 -2
  38. package/package.json +6 -6
  39. package/src/components/Avatar/Avatar.tsx +4 -0
  40. package/src/components/Avatar/examples/Avatar.md +33 -4
  41. package/src/components/ClipboardCopy/examples/ClipboardCopy.md +11 -123
  42. package/src/components/ClipboardCopy/examples/ClipboardCopyBasic.tsx +8 -0
  43. package/src/components/ClipboardCopy/examples/ClipboardCopyExpanded.tsx +9 -0
  44. package/src/components/ClipboardCopy/examples/ClipboardCopyExpandedWithArray.tsx +14 -0
  45. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompact.tsx +7 -0
  46. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactCode.tsx +8 -0
  47. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactInSentence.tsx +36 -0
  48. package/src/components/ClipboardCopy/examples/ClipboardCopyInlineCompactWithAdditionalAction.tsx +20 -0
  49. package/src/components/ClipboardCopy/examples/ClipboardCopyJSONObject.tsx +18 -0
  50. package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnly.tsx +8 -0
  51. package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnlyExpanded.tsx +9 -0
  52. package/src/components/ClipboardCopy/examples/ClipboardCopyReadOnlyExpandedByDefault.tsx +9 -0
  53. package/src/components/FormSelect/FormSelect.tsx +16 -1
  54. package/src/components/FormSelect/examples/FormSelect.md +58 -0
  55. package/src/components/TextArea/TextArea.tsx +5 -0
  56. package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +2 -0
  57. package/src/components/TextArea/examples/TextArea.md +43 -0
  58. package/src/components/TextInput/TextInput.tsx +5 -0
  59. package/src/components/TextInput/__tests__/__snapshots__/TextInput.test.tsx.snap +2 -0
  60. package/src/components/TextInput/examples/TextInput.md +104 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.199.3",
3
+ "version": "4.200.0",
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.50.3",
38
- "@patternfly/react-styles": "^4.49.3",
39
- "@patternfly/react-tokens": "^4.51.3",
37
+ "@patternfly/react-icons": "^4.51.0",
38
+ "@patternfly/react-styles": "^4.50.0",
39
+ "@patternfly/react-tokens": "^4.52.0",
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.183.1",
46
+ "@patternfly/patternfly": "4.183.2",
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": "5ebdd87969330ddee041f3a5b91ef9293be16abd"
63
+ "gitHead": "ece8d3daaff4df670618823e159fa5eea1b95490"
64
64
  }
@@ -12,6 +12,8 @@ export interface AvatarProps
12
12
  alt: string;
13
13
  /** Border to add */
14
14
  border?: 'light' | 'dark';
15
+ /** Size variant of avatar. */
16
+ size?: 'sm' | 'md' | 'lg' | 'xl';
15
17
  }
16
18
 
17
19
  export const Avatar: React.FunctionComponent<AvatarProps> = ({
@@ -19,6 +21,7 @@ export const Avatar: React.FunctionComponent<AvatarProps> = ({
19
21
  src = '',
20
22
  alt,
21
23
  border,
24
+ size,
22
25
  ...props
23
26
  }: AvatarProps) => (
24
27
  <img
@@ -26,6 +29,7 @@ export const Avatar: React.FunctionComponent<AvatarProps> = ({
26
29
  alt={alt}
27
30
  className={css(
28
31
  styles.avatar,
32
+ styles.modifiers[size],
29
33
  border === 'light' && styles.modifiers.light,
30
34
  border === 'dark' && styles.modifiers.dark,
31
35
  className
@@ -10,30 +10,59 @@ import avatarImgDark from './avatarImgDark.svg';
10
10
  import './example.css';
11
11
 
12
12
  ## Examples
13
+
13
14
  ### Basic
15
+
14
16
  ```ts
15
17
  import React from 'react';
16
18
  import { Avatar } from '@patternfly/react-core';
17
19
  import avatarImg from './avatarImg.svg';
18
20
 
19
- <Avatar src={avatarImg} alt="avatar" />
21
+ <Avatar src={avatarImg} alt="avatar" />;
22
+ ```
23
+
24
+ ### Size variations
25
+
26
+ ```ts
27
+ import React from 'react';
28
+ import { Avatar } from '@patternfly/react-core';
29
+ import avatarImg from './avatarImg.svg';
30
+
31
+ <React.Fragment>
32
+ Small
33
+ <br />
34
+ <Avatar src={avatarImg} alt="avatar" size="sm" />
35
+ <br />
36
+ Medium
37
+ <br />
38
+ <Avatar src={avatarImg} alt="avatar" size="md" />
39
+ <br />
40
+ Large
41
+ <br />
42
+ <Avatar src={avatarImg} alt="avatar" size="lg" />
43
+ <br />
44
+ Extra Large
45
+ <br />
46
+ <Avatar src={avatarImg} alt="avatar" size="xl" />
47
+ </React.Fragment>;
20
48
  ```
21
49
 
22
50
  ### Bordered - light
51
+
23
52
  ```ts
24
53
  import React from 'react';
25
54
  import { Avatar } from '@patternfly/react-core';
26
55
  import avatarImg from './img_avatar.svg';
27
56
 
28
- <Avatar src={avatarImg} alt="avatar" border="light" />
57
+ <Avatar src={avatarImg} alt="avatar" border="light" />;
29
58
  ```
30
59
 
31
60
  ### Bordered - dark
61
+
32
62
  ```ts
33
63
  import React from 'react';
34
64
  import { Avatar } from '@patternfly/react-core';
35
65
  import avatarImgDark from './img_avatar-dark.svg';
36
66
 
37
- <Avatar src={avatarImgDark} alt="avatar" border="dark" />
67
+ <Avatar src={avatarImgDark} alt="avatar" border="dark" />;
38
68
  ```
39
-
@@ -11,167 +11,55 @@ import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
11
11
 
12
12
  ### Basic
13
13
 
14
- ```js
15
- import React from 'react';
16
- import { ClipboardCopy } from '@patternfly/react-core';
17
-
18
- <ClipboardCopy hoverTip="Copy" clickTip="Copied">This is editable</ClipboardCopy>;
14
+ ```ts file="./ClipboardCopyBasic.tsx"
19
15
  ```
20
16
 
21
17
  ### Read Only
22
18
 
23
- ```js
24
- import React from 'react';
25
- import { ClipboardCopy } from '@patternfly/react-core';
26
-
27
- <ClipboardCopy isReadOnly hoverTip="Copy" clickTip="Copied">This is read-only</ClipboardCopy>;
19
+ ```ts file="./ClipboardCopyReadOnly.tsx"
28
20
  ```
29
21
 
30
22
  ### Expanded
31
23
 
32
- ```js
33
- import React from 'react';
34
- import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
35
-
36
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion} >
37
- Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
38
- expansion.
39
- </ClipboardCopy>;
24
+ ```ts file="./ClipboardCopyExpanded.tsx"
40
25
  ```
41
26
 
42
27
  ### Read only expanded
43
28
 
44
- ```js
45
- import React from 'react';
46
- import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
47
-
48
- <ClipboardCopy isReadOnly hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
49
- Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
50
- expansion.
51
- </ClipboardCopy>;
29
+ ```ts file="./ClipboardCopyReadOnlyExpanded.tsx"
52
30
  ```
53
31
 
54
32
  ### Read only expanded by default
55
33
 
56
- ```js
57
- import React from 'react';
58
- import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
59
-
60
- <ClipboardCopy isReadOnly isExpanded hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
61
- Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
62
- expansion.
63
- </ClipboardCopy>;
34
+ ```ts file="./ClipboardCopyReadOnlyExpandedByDefault.tsx"
64
35
  ```
65
36
 
66
37
  ### Expanded with array
67
38
 
68
- ```js
69
- import React from 'react';
70
- import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
71
-
72
- ClipboardCopyArrayOfElements = () => {
73
- let text = [
74
- 'Got a lot of text here,',
75
- 'need to see all of it?',
76
- 'Click that arrow on the left side and check out the resulting expansion.'
77
- ];
78
- return <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>{text.join(' ')}</ClipboardCopy>;
79
- };
39
+ ```ts file="./ClipboardCopyExpandedWithArray.tsx"
80
40
  ```
81
41
 
82
42
  ### JSON object (wrap code with pre)
83
43
 
84
- ```js
85
- import React from 'react';
86
- import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
87
-
88
- <ClipboardCopy isCode hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
89
- {`{ "menu": {
90
- "id": "file",
91
- "value": "File",
92
- "popup": {
93
- "menuitem": [
94
- {"value": "New", "onclick": "CreateNewDoc()"},
95
- {"value": "Open", "onclick": "OpenDoc()"},
96
- {"value": "Close", "onclick": "CloseDoc()"}
97
- ]
98
- }
99
- }} `}
100
- </ClipboardCopy>;
44
+ ```ts file="./ClipboardCopyJSONObject.tsx"
101
45
  ```
102
46
 
103
47
  ### Inline compact
104
48
 
105
- ```js
106
- import React from 'react';
107
- import { ClipboardCopy } from '@patternfly/react-core';
108
-
109
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">2.3.4-2-redhat</ClipboardCopy>;
49
+ ```ts file="./ClipboardCopyInlineCompact.tsx"
110
50
  ```
111
51
 
112
52
  ### Inline compact code
113
53
 
114
- ```js
115
- import React from 'react';
116
- import { ClipboardCopy } from '@patternfly/react-core';
117
-
118
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isCode>
119
- 2.3.4-2-redhat
120
- </ClipboardCopy>;
54
+ ```ts file="./ClipboardCopyInlineCompactCode.tsx"
121
55
  ```
122
56
 
123
57
  ### Inline compact with additional action
124
58
 
125
- ```js
126
- import React from 'react';
127
- import { ClipboardCopy, ClipboardCopyAction, Button } from '@patternfly/react-core';
128
- import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
129
-
130
- <ClipboardCopy
131
- hoverTip="Copy"
132
- clickTip="Copied"
133
- variant="inline-compact"
134
- additionalActions={
135
- <ClipboardCopyAction>
136
- <Button variant="plain" aria-label="Run in web terminal">
137
- <PlayIcon aria-hidden />
138
- </Button>
139
- </ClipboardCopyAction>
140
- }
141
- >
142
- 2.3.4-2-redhat
143
- </ClipboardCopy>;
59
+ ```ts file="./ClipboardCopyInlineCompactWithAdditionalAction.tsx"
144
60
  ```
145
61
 
146
62
  ### Inline compact in sentence
147
63
 
148
- ```js
149
- import React from 'react';
150
- import { ClipboardCopy } from '@patternfly/react-core';
151
-
152
- <React.Fragment>
153
- <b>Basic</b>
154
- <br />
155
- Lorem ipsum {<ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">2.3.4-2-redhat</ClipboardCopy>} dolor sit amet.
156
- <br /> <br />
157
- <b>Long copy string</b>
158
- <br />
159
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
160
- {
161
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
162
- https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
163
- </ClipboardCopy>
164
- }{' '}
165
- Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
166
- <br /> <br />
167
- <b>Long copy string in block</b>
168
- <br />
169
- Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
170
- {
171
- <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isBlock>
172
- https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
173
- </ClipboardCopy>
174
- }{' '}
175
- Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
176
- </React.Fragment>;
64
+ ```ts file="./ClipboardCopyInlineCompactInSentence.tsx"
177
65
  ```
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyBasic: React.FunctionComponent = () => (
5
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied">
6
+ This is editable
7
+ </ClipboardCopy>
8
+ );
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyExpanded: React.FunctionComponent = () => (
5
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
6
+ Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
7
+ expansion.
8
+ </ClipboardCopy>
9
+ );
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
3
+
4
+ const text = [
5
+ 'Got a lot of text here,',
6
+ 'need to see all of it?',
7
+ 'Click that arrow on the left side and check out the resulting expansion.'
8
+ ];
9
+
10
+ export const ClipboardCopyExpandedWithArray: React.FunctionComponent = () => (
11
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
12
+ {text.join(' ')}
13
+ </ClipboardCopy>
14
+ );
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy } from '@patternfly/react-core';
3
+ export const ClipboardCopyInlineCompact: React.FunctionComponent = () => (
4
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
5
+ 2.3.4-2-redhat
6
+ </ClipboardCopy>
7
+ );
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyInlineCompactCode: React.FunctionComponent = () => (
5
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isCode>
6
+ 2.3.4-2-redhat
7
+ </ClipboardCopy>
8
+ );
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyInlineCompactInSentence: React.FunctionComponent = () => (
5
+ <React.Fragment>
6
+ <b>Basic</b>
7
+ <br />
8
+ Lorem ipsum{' '}
9
+ {
10
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
11
+ 2.3.4-2-redhat
12
+ </ClipboardCopy>
13
+ }
14
+ dolor sit amet.
15
+ <br /> <br />
16
+ <b>Long copy string</b>
17
+ <br />
18
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
19
+ {
20
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact">
21
+ https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
22
+ </ClipboardCopy>
23
+ }{' '}
24
+ Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
25
+ <br /> <br />
26
+ <b>Long copy string in block</b>
27
+ <br />
28
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.{' '}
29
+ {
30
+ <ClipboardCopy hoverTip="Copy" clickTip="Copied" variant="inline-compact" isBlock>
31
+ https://app.openshift.io/path/sub-path/sub-sub-path/?runtime=quarkus/12345678901234567890/abcdefghijklmnopqrstuvwxyz1234567890
32
+ </ClipboardCopy>
33
+ }{' '}
34
+ Mauris luctus, libero nec dapibus ultricies, urna purus pretium mauris, ullamcorper pharetra lacus nibh vitae enim.
35
+ </React.Fragment>
36
+ );
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy, ClipboardCopyAction, Button } from '@patternfly/react-core';
3
+ import PlayIcon from '@patternfly/react-icons/dist/esm/icons/play-icon';
4
+
5
+ export const ClipboardCopyInlineCompactWithAdditionalAction: React.FunctionComponent = () => (
6
+ <ClipboardCopy
7
+ hoverTip="Copy"
8
+ clickTip="Copied"
9
+ variant="inline-compact"
10
+ additionalActions={
11
+ <ClipboardCopyAction>
12
+ <Button variant="plain" aria-label="Run in web terminal">
13
+ <PlayIcon aria-hidden />
14
+ </Button>
15
+ </ClipboardCopyAction>
16
+ }
17
+ >
18
+ 2.3.4-2-redhat
19
+ </ClipboardCopy>
20
+ );
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyJSONObject: React.FunctionComponent = () => (
5
+ <ClipboardCopy isCode hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
6
+ {`{ "menu": {
7
+ "id": "file",
8
+ "value": "File",
9
+ "popup": {
10
+ "menuitem": [
11
+ {"value": "New", "onclick": "CreateNewDoc()"},
12
+ {"value": "Open", "onclick": "OpenDoc()"},
13
+ {"value": "Close", "onclick": "CloseDoc()"}
14
+ ]
15
+ }
16
+ }} `}
17
+ </ClipboardCopy>
18
+ );
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyReadOnly: React.FunctionComponent = () => (
5
+ <ClipboardCopy isReadOnly hoverTip="Copy" clickTip="Copied">
6
+ This is read-only
7
+ </ClipboardCopy>
8
+ );
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyReadOnlyExpanded: React.FunctionComponent = () => (
5
+ <ClipboardCopy isReadOnly hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
6
+ Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
7
+ expansion.
8
+ </ClipboardCopy>
9
+ );
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ClipboardCopy, ClipboardCopyVariant } from '@patternfly/react-core';
3
+
4
+ export const ClipboardCopyReadOnlyExpandedByDefault: React.FunctionComponent = () => (
5
+ <ClipboardCopy isReadOnly isExpanded hoverTip="Copy" clickTip="Copied" variant={ClipboardCopyVariant.expansion}>
6
+ Got a lot of text here, need to see all of it? Click that arrow on the left side and check out the resulting
7
+ expansion.
8
+ </ClipboardCopy>
9
+ );
@@ -23,6 +23,8 @@ export interface FormSelectProps
23
23
  isDisabled?: boolean;
24
24
  /** Sets the FormSelect required. */
25
25
  isRequired?: boolean;
26
+ /** Use the external file instead of a data URI */
27
+ isIconSprite?: boolean;
26
28
  /** Optional callback for updating when selection loses focus */
27
29
  onBlur?: (event: React.FormEvent<HTMLSelectElement>) => void;
28
30
  /** Optional callback for updating when selection gets focus */
@@ -52,6 +54,7 @@ export class FormSelect extends React.Component<FormSelectProps, { ouiaStateId:
52
54
  validated: 'default',
53
55
  isDisabled: false,
54
56
  isRequired: false,
57
+ isIconSprite: false,
55
58
  onBlur: (): any => undefined,
56
59
  onFocus: (): any => undefined,
57
60
  onChange: (): any => undefined,
@@ -63,7 +66,18 @@ export class FormSelect extends React.Component<FormSelectProps, { ouiaStateId:
63
66
  };
64
67
 
65
68
  render() {
66
- const { children, className, value, validated, isDisabled, isRequired, ouiaId, ouiaSafe, ...props } = this.props;
69
+ const {
70
+ children,
71
+ className,
72
+ value,
73
+ validated,
74
+ isDisabled,
75
+ isRequired,
76
+ isIconSprite,
77
+ ouiaId,
78
+ ouiaSafe,
79
+ ...props
80
+ } = this.props;
67
81
  /* find selected option and get placeholder flag */
68
82
  const selectedOption = React.Children.toArray(children).find((option: any) => option.props.value === value) as any;
69
83
  const isSelectedPlaceholder = selectedOption && selectedOption.props.isPlaceholder;
@@ -72,6 +86,7 @@ export class FormSelect extends React.Component<FormSelectProps, { ouiaStateId:
72
86
  {...props}
73
87
  className={css(
74
88
  styles.formControl,
89
+ isIconSprite && styles.modifiers.iconSprite,
75
90
  className,
76
91
  validated === ValidatedOptions.success && styles.modifiers.success,
77
92
  validated === ValidatedOptions.warning && styles.modifiers.warning,
@@ -258,3 +258,61 @@ class FormSelectInputGrouped extends React.Component {
258
258
  }
259
259
  }
260
260
  ```
261
+
262
+ ### Icon sprite variant
263
+
264
+ **Note:** The dropdown toggle icon is applied as a background image to the form element. By default, the image URLs for these icons are data URIs. However, there may be cases where data URIs are not ideal, such as in an application with a content security policy that disallows data URIs for security reasons. The `isIconSprite` variation changes the icon source to an external SVG file that serves as a sprite for all of the supported icons.
265
+
266
+ ```js isBeta
267
+ import React from 'react';
268
+ import { FormSelect, FormSelectOption, FormSelectOptionGroup } from '@patternfly/react-core';
269
+
270
+ class FormSelectIconSpriteInput extends React.Component {
271
+ constructor(props) {
272
+ super(props);
273
+ this.state = {
274
+ value: '',
275
+ validated: ValidatedOptions.default
276
+ };
277
+
278
+ this.onChange = (value, event) => {
279
+ if (value === '3') {
280
+ this.setState({ value, validated: ValidatedOptions.success, helperText: 'You chose wisely' });
281
+ } else if (value === '') {
282
+ this.setState({ value, validated: ValidatedOptions.warning, helperText: 'You must select a value' });
283
+ } else {
284
+ this.setState({
285
+ value,
286
+ validated: ValidatedOptions.error,
287
+ invalidText: 'You must chose Three (thought that was obvious)'
288
+ });
289
+ }
290
+ };
291
+
292
+ this.options = [
293
+ { value: '', label: 'Select a number', disabled: false, isPlaceholder: true },
294
+ { value: '1', label: 'One', disabled: false, isPlaceholder: false },
295
+ { value: '2', label: 'Two', disabled: false, isPlaceholder: false },
296
+ { value: '3', label: 'Three - the only valid option', disabled: false, isPlaceholder: false }
297
+ ];
298
+ }
299
+
300
+ render() {
301
+ const { value, validated, helperText, invalidText } = this.state;
302
+
303
+ return (
304
+ <FormSelect
305
+ validated={validated}
306
+ isIconSprite
307
+ value={value}
308
+ onChange={this.onChange}
309
+ aria-label="FormSelect Input"
310
+ >
311
+ {this.options.map((option, index) => (
312
+ <FormSelectOption isDisabled={option.disabled} key={index} value={option.value} label={option.label} />
313
+ ))}
314
+ </FormSelect>
315
+ );
316
+ }
317
+ }
318
+ ```
@@ -20,6 +20,8 @@ export interface TextAreaProps extends Omit<HTMLProps<HTMLTextAreaElement>, 'onC
20
20
  isDisabled?: boolean;
21
21
  /** Flag to show if the TextArea is read only. */
22
22
  isReadOnly?: boolean;
23
+ /** Use the external file instead of a data URI */
24
+ isIconSprite?: boolean;
23
25
  /** Flag to modify height based on contents. */
24
26
  autoResize?: boolean;
25
27
  /** Value to indicate if the textarea is modified to show that validation state.
@@ -46,6 +48,7 @@ export class TextAreaBase extends React.Component<TextAreaProps> {
46
48
  className: '',
47
49
  isRequired: false,
48
50
  isDisabled: false,
51
+ isIconSprite: false,
49
52
  validated: 'default',
50
53
  resizeOrientation: 'both',
51
54
  'aria-label': null as string
@@ -86,6 +89,7 @@ export class TextAreaBase extends React.Component<TextAreaProps> {
86
89
  validated,
87
90
  isRequired,
88
91
  isDisabled,
92
+ isIconSprite,
89
93
  isReadOnly,
90
94
  resizeOrientation,
91
95
  innerRef,
@@ -102,6 +106,7 @@ export class TextAreaBase extends React.Component<TextAreaProps> {
102
106
  <textarea
103
107
  className={css(
104
108
  styles.formControl,
109
+ isIconSprite && styles.modifiers.iconSprite,
105
110
  className,
106
111
  resizeOrientation !== TextAreResizeOrientation.both && styles.modifiers[orientation],
107
112
  validated === ValidatedOptions.success && styles.modifiers.success,
@@ -116,6 +116,7 @@ exports[`validated text area success 1`] = `
116
116
  className=""
117
117
  innerRef={null}
118
118
  isDisabled={false}
119
+ isIconSprite={false}
119
120
  isRequired={false}
120
121
  onChange={[MockFunction]}
121
122
  required={true}
@@ -148,6 +149,7 @@ exports[`validated text area warning 1`] = `
148
149
  className=""
149
150
  innerRef={null}
150
151
  isDisabled={false}
152
+ isIconSprite={false}
151
153
  isRequired={false}
152
154
  onChange={[MockFunction]}
153
155
  required={true}
@@ -207,3 +207,46 @@ import { TextArea } from '@patternfly/react-core';
207
207
  <TextArea aria-label="auto resizing text area example" autoResize />
208
208
  ```
209
209
 
210
+ ### Icon sprite variants
211
+
212
+ **Note:** The icons for the success, invalid, calendar, etc. variations in form control elements are applied as background images to the form element. By default, the image URLs for these icons are data URIs. However, there may be cases where data URIs are not ideal, such as in an application with a content security policy that disallows data URIs for security reasons. The `isIconSprite` variation changes the icon source to an external SVG file that serves as a sprite for all of the supported icons.
213
+
214
+ ```js isBeta
215
+ import React from 'react';
216
+ import { TextArea } from '@patternfly/react-core';
217
+
218
+ IconSpriteTextArea = () => {
219
+ const [success, setSuccess] = React.useState('');
220
+ const [warning, setWarning] = React.useState('');
221
+ const [error, setError] = React.useState('');
222
+
223
+ return (
224
+ <>
225
+ <TextArea
226
+ validated={ValidatedOptions.success}
227
+ isIconSprite
228
+ type="text"
229
+ onChange={value => setSuccess(value)}
230
+ aria-label="success icon sprite text area example"
231
+ />
232
+ <br />
233
+ <br />
234
+ <TextArea
235
+ validated={ValidatedOptions.warning}
236
+ isIconSprite
237
+ type="text"
238
+ onChange={value => setWarning(value)}
239
+ aria-label="warning icon sprite text input example"
240
+ />
241
+ <br />
242
+ <br />
243
+ <TextArea
244
+ validated={ValidatedOptions.error}
245
+ isIconSprite
246
+ type="text"
247
+ onChange={value => setError(value)}
248
+ aria-label="error icon sprite text area example"
249
+ />
250
+ </>
251
+ );
252
+ };