@patternfly/react-core 4.250.8 → 4.251.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 CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.251.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.251.0...@patternfly/react-core@4.251.1) (2022-10-13)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
14
+ # [4.251.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.250.8...@patternfly/react-core@4.251.0) (2022-10-13)
15
+
16
+
17
+ ### Features
18
+
19
+ * **label+labelGroup:** update aria-labels to include label text ([#8192](https://github.com/patternfly/patternfly-react/issues/8192)) ([f99a34d](https://github.com/patternfly/patternfly-react/commit/f99a34d503699d169cc2376841ec48fc9eb66bad))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [4.250.8](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.250.7...@patternfly/react-core@4.250.8) (2022-10-13)
7
26
 
8
27
 
@@ -3628,44 +3628,6 @@ label.pf-c-check, .pf-c-check__label,
3628
3628
  border: 0;
3629
3629
  }
3630
3630
 
3631
- .pf-c-code-block {
3632
- --pf-c-code-block--BackgroundColor: var(--pf-global--BackgroundColor--200);
3633
- --pf-c-code-block__header--BorderBottomWidth: var(--pf-global--BorderWidth--sm);
3634
- --pf-c-code-block__header--BorderBottomColor: var(--pf-global--BorderColor--100);
3635
- --pf-c-code-block__content--PaddingTop: var(--pf-global--spacer--md);
3636
- --pf-c-code-block__content--PaddingRight: var(--pf-global--spacer--md);
3637
- --pf-c-code-block__content--PaddingBottom: var(--pf-global--spacer--md);
3638
- --pf-c-code-block__content--PaddingLeft: var(--pf-global--spacer--md);
3639
- --pf-c-code-block__pre--FontFamily: var(--pf-global--FontFamily--monospace);
3640
- --pf-c-code-block__pre--FontSize: var(--pf-global--FontSize--sm);
3641
- background-color: var(--pf-c-code-block--BackgroundColor);
3642
- }
3643
-
3644
- .pf-c-code-block__header {
3645
- display: flex;
3646
- border-bottom: var(--pf-c-code-block__header--BorderBottomWidth) solid var(--pf-c-code-block__header--BorderBottomColor);
3647
- }
3648
-
3649
- .pf-c-code-block__actions {
3650
- display: flex;
3651
- margin-left: auto;
3652
- }
3653
-
3654
- .pf-c-code-block__content {
3655
- padding: var(--pf-c-code-block__content--PaddingTop) var(--pf-c-code-block__content--PaddingRight) var(--pf-c-code-block__content--PaddingBottom) var(--pf-c-code-block__content--PaddingLeft);
3656
- }
3657
-
3658
- .pf-c-code-block__pre {
3659
- font-family: var(--pf-c-code-block__pre--FontFamily);
3660
- font-size: var(--pf-c-code-block__pre--FontSize);
3661
- overflow-wrap: break-word;
3662
- white-space: pre-wrap;
3663
- }
3664
-
3665
- .pf-c-code-block__code {
3666
- font-family: var(--pf-c-code-block__code--FontFamily, inherit);
3667
- }
3668
-
3669
3631
  .pf-c-context-selector__menu {
3670
3632
  --pf-global--Color--100: var(--pf-global--Color--dark-100);
3671
3633
  --pf-global--Color--200: var(--pf-global--Color--dark-200);
@@ -4000,6 +3962,44 @@ label.pf-c-check, .pf-c-check__label,
4000
3962
  border-top: 1px solid var(--pf-global--BorderColor--300);
4001
3963
  }
4002
3964
 
3965
+ .pf-c-code-block {
3966
+ --pf-c-code-block--BackgroundColor: var(--pf-global--BackgroundColor--200);
3967
+ --pf-c-code-block__header--BorderBottomWidth: var(--pf-global--BorderWidth--sm);
3968
+ --pf-c-code-block__header--BorderBottomColor: var(--pf-global--BorderColor--100);
3969
+ --pf-c-code-block__content--PaddingTop: var(--pf-global--spacer--md);
3970
+ --pf-c-code-block__content--PaddingRight: var(--pf-global--spacer--md);
3971
+ --pf-c-code-block__content--PaddingBottom: var(--pf-global--spacer--md);
3972
+ --pf-c-code-block__content--PaddingLeft: var(--pf-global--spacer--md);
3973
+ --pf-c-code-block__pre--FontFamily: var(--pf-global--FontFamily--monospace);
3974
+ --pf-c-code-block__pre--FontSize: var(--pf-global--FontSize--sm);
3975
+ background-color: var(--pf-c-code-block--BackgroundColor);
3976
+ }
3977
+
3978
+ .pf-c-code-block__header {
3979
+ display: flex;
3980
+ border-bottom: var(--pf-c-code-block__header--BorderBottomWidth) solid var(--pf-c-code-block__header--BorderBottomColor);
3981
+ }
3982
+
3983
+ .pf-c-code-block__actions {
3984
+ display: flex;
3985
+ margin-left: auto;
3986
+ }
3987
+
3988
+ .pf-c-code-block__content {
3989
+ padding: var(--pf-c-code-block__content--PaddingTop) var(--pf-c-code-block__content--PaddingRight) var(--pf-c-code-block__content--PaddingBottom) var(--pf-c-code-block__content--PaddingLeft);
3990
+ }
3991
+
3992
+ .pf-c-code-block__pre {
3993
+ font-family: var(--pf-c-code-block__pre--FontFamily);
3994
+ font-size: var(--pf-c-code-block__pre--FontSize);
3995
+ overflow-wrap: break-word;
3996
+ white-space: pre-wrap;
3997
+ }
3998
+
3999
+ .pf-c-code-block__code {
4000
+ font-family: var(--pf-c-code-block__code--FontFamily, inherit);
4001
+ }
4002
+
4003
4003
  .pf-c-data-list {
4004
4004
  --pf-global--Color--100: var(--pf-global--Color--dark-100);
4005
4005
  --pf-global--Color--200: var(--pf-global--Color--dark-200);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.250.8",
3
+ "version": "4.251.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",
@@ -70,5 +70,5 @@
70
70
  "react": "^16.8 || ^17 || ^18",
71
71
  "react-dom": "^16.8 || ^17 || ^18"
72
72
  },
73
- "gitHead": "0afb2a934643bd11219312fc058b354a629dbc76"
73
+ "gitHead": "9eacaae1c7ae678cc139c0ee937c158483826c18"
74
74
  }
@@ -31,7 +31,7 @@ export const LabelEditable: React.FunctionComponent = () => {
31
31
  onEditComplete={onEditComplete}
32
32
  isEditable
33
33
  editableProps={{
34
- 'aria-label': 'Editable text',
34
+ 'aria-label': `Editable label with text ${labelText}`,
35
35
  id: 'editable-label'
36
36
  }}
37
37
  >
@@ -46,7 +46,7 @@ export const LabelEditable: React.FunctionComponent = () => {
46
46
  onEditComplete={onCompactEditComplete}
47
47
  isEditable
48
48
  editableProps={{
49
- 'aria-label': 'Compact editable text',
49
+ 'aria-label': `Editable compact label with text ${compactLabelText}`,
50
50
  id: 'compact-editable-label'
51
51
  }}
52
52
  >
@@ -11,7 +11,7 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
11
11
  props: {
12
12
  isEditable: true,
13
13
  editableProps: {
14
- 'aria-label': 'label editable text'
14
+ 'aria-label': 'Editable label with text Label 3'
15
15
  }
16
16
  },
17
17
  id: 2
@@ -24,7 +24,12 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
24
24
 
25
25
  const onEdit = (nextText: string, index: number) => {
26
26
  const copy = [...labels];
27
- copy[index] = { name: nextText, props: labels[index].props, id: labels[index].id };
27
+ const updatedProps = {
28
+ ...labels[index].props,
29
+ editableProps: { 'aria-label': `Editable label with text ${nextText}` }
30
+ };
31
+
32
+ copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };
28
33
  setLabels(copy);
29
34
  };
30
35
 
@@ -35,7 +40,7 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
35
40
  props: {
36
41
  isEditable: true,
37
42
  editableProps: {
38
- 'aria-label': 'label editable text'
43
+ 'aria-label': `Editable label with text New Label`
39
44
  }
40
45
  },
41
46
  id: idIndex
@@ -16,7 +16,7 @@ export const LabelGroupEditableAddDropdown: React.FunctionComponent = () => {
16
16
  props: {
17
17
  isEditable: true,
18
18
  editableProps: {
19
- 'aria-label': 'label editable text'
19
+ 'aria-label': 'Editable label with text Label 3'
20
20
  }
21
21
  },
22
22
  id: 2
@@ -29,7 +29,12 @@ export const LabelGroupEditableAddDropdown: React.FunctionComponent = () => {
29
29
 
30
30
  const onEdit = (nextText: string, index: number) => {
31
31
  const copy = [...labels];
32
- copy[index] = { name: nextText, props: labels[index].props, id: labels[index].id };
32
+ const updatedProps = {
33
+ ...labels[index].props,
34
+ editableProps: { 'aria-label': `Editable label with text ${nextText}` }
35
+ };
36
+
37
+ copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };
33
38
  setLabels(copy);
34
39
  };
35
40
 
@@ -47,7 +47,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
47
47
  props: {
48
48
  isEditable: true,
49
49
  editableProps: {
50
- 'aria-label': 'label editable text'
50
+ 'aria-label': 'Editable label with text Label 3'
51
51
  }
52
52
  },
53
53
  id: 6
@@ -60,7 +60,12 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
60
60
 
61
61
  const onEdit = (nextText: string, index: number) => {
62
62
  const copy = [...labels];
63
- copy[index] = { name: nextText, props: labels[index].props, id: labels[index].id };
63
+ const updatedProps = {
64
+ ...labels[index].props,
65
+ editableProps: { 'aria-label': `Editable label with text ${nextText}` }
66
+ };
67
+
68
+ copy[index] = { name: nextText, props: updatedProps, id: labels[index].id };
64
69
  setLabels(copy);
65
70
  };
66
71
 
@@ -81,7 +86,7 @@ export const LabelGroupEditableAddModal: React.FunctionComponent = () => {
81
86
  isEditable: isEditable !== undefined ? isEditable : true,
82
87
  ...(isEditable && {
83
88
  editableProps: {
84
- 'aria-label': 'label editable text'
89
+ 'aria-label': `Editable label with text ${labelText || 'New Label'}`
85
90
  }
86
91
  })
87
92
  },
@@ -15,7 +15,7 @@ export const LabelGroupEditableLabels: React.FunctionComponent = () => {
15
15
  onEditComplete={newText => setLabel1(newText)}
16
16
  isEditable
17
17
  editableProps={{
18
- 'aria-label': 'Editable text',
18
+ 'aria-label': `Editable label with text ${label1}`,
19
19
  id: 'editable-label-1'
20
20
  }}
21
21
  >
@@ -29,7 +29,7 @@ export const LabelGroupEditableLabels: React.FunctionComponent = () => {
29
29
  onEditComplete={newText => setLabel2(newText)}
30
30
  isEditable
31
31
  editableProps={{
32
- 'aria-label': 'Editable text 2',
32
+ 'aria-label': `Editable label with text ${label2}`,
33
33
  id: 'editable-label-2'
34
34
  }}
35
35
  >
@@ -42,7 +42,7 @@ export const LabelGroupEditableLabels: React.FunctionComponent = () => {
42
42
  onEditComplete={newText => setLabel3(newText)}
43
43
  isEditable
44
44
  editableProps={{
45
- 'aria-label': 'Editable text 3',
45
+ 'aria-label': `Editable label with text ${label3}`,
46
46
  id: 'editable-label-3'
47
47
  }}
48
48
  >
@@ -7,107 +7,5 @@ propComponents: ['SkipToContent']
7
7
 
8
8
  ## Examples
9
9
  ### Basic
10
- ```js isFullscreen
11
- import React from 'react';
12
- import { SkipToContent } from '@patternfly/react-core';
13
-
14
- class SimpleSkipToContent extends React.Component {
15
- render() {
16
- return (
17
- <React.Fragment>
18
- <SkipToContent href="#main-content">Skip to content</SkipToContent>
19
- <p>Press tab to skip to content at the bottom of the page.</p>
20
- <div style={{ height: '2000px' }}></div>
21
- <h1 id="main-content">Main content</h1>
22
- <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan, metus ultrices eleifend gravida, nulla nunc varius
23
- lectus, nec rutrum justo nibh eu lectus. Ut vulputate semper dui. Fusce erat odio, sollicitudin vel erat vel, interdum
24
- mattis neque. Sub works as well!</p>
25
- <h2>Second level</h2>
26
- <p>Curabitur accumsan turpis pharetra
27
- <strong>augue tincidunt</strong> blandit. Quisque condimentum maximus mi, sit amet commodo arcu rutrum id. Proin pretium urna vel
28
- cursus venenatis. Suspendisse potenti. Etiam mattis sem rhoncus lacus dapibus facilisis. Donec at dignissim dui. Ut et
29
- neque nisl.</p>
30
- <ul>
31
- <li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>
32
- <li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>
33
- <li>Aliquam nec felis in sapien venenatis viverra fermentum nec lectus.
34
- <ul>
35
- <li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>
36
- <li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>
37
- <li>Ut venenatis, nisl scelerisque.
38
- <ol>
39
- <li>Donec blandit a lorem id convallis.</li>
40
- <li>Cras gravida arcu at diam gravida gravida.</li>
41
- <li>Integer in volutpat libero.</li>
42
- </ol>
43
- </li>
44
- </ul>
45
- </li>
46
- <li>Ut non enim metus.</li>
47
- </ul>
48
- <h3>Third level</h3>
49
- <p>Quisque ante lacus, malesuada ac auctor vitae, congue
50
- <a href="#">non ante</a>. Phasellus lacus ex, semper ac tortor nec, fringilla condimentum orci. Fusce eu rutrum tellus.</p>
51
- <ol>
52
- <li>Donec blandit a lorem id convallis.</li>
53
- <li>Cras gravida arcu at diam gravida gravida.</li>
54
- <li>Integer in volutpat libero.</li>
55
- <li>Donec a diam tellus.</li>
56
- <li>Etiam auctor nisl et.
57
- <ul>
58
- <li>Donec blandit a lorem id convallis.</li>
59
- <li>Cras gravida arcu at diam gravida gravida.</li>
60
- <li>Integer in volutpat libero.
61
- <ol>
62
- <li>Donec blandit a lorem id convallis.</li>
63
- <li>Cras gravida arcu at diam gravida gravida.</li>
64
- </ol>
65
- </li>
66
- </ul>
67
- </li>
68
- <li>Aenean nec tortor orci.</li>
69
- <li>Quisque aliquam cursus urna, non bibendum massa viverra eget.</li>
70
- <li>Vivamus maximus ultricies pulvinar.</li>
71
- </ol>
72
- <blockquote>Ut venenatis, nisl scelerisque sollicitudin fermentum, quam libero hendrerit ipsum, ut blandit est tellus sit amet turpis.</blockquote>
73
- <p>Quisque at semper enim, eu hendrerit odio. Etiam auctor nisl et
74
- <em>justo sodales</em> elementum. Maecenas ultrices lacus quis neque consectetur, et lobortis nisi molestie.</p>
75
- <hr />
76
- <p>Sed sagittis enim ac tortor maximus rutrum. Nulla facilisi. Donec mattis vulputate risus in luctus. Maecenas vestibulum interdum
77
- commodo.
78
- </p>
79
- <dl>
80
- <dt>Web</dt>
81
- <dd>The part of the internet that contains websites and web pages</dd>
82
- <dt>HTML</dt>
83
- <dd>A markup language for creating web pages</dd>
84
- <dt>CSS</dt>
85
- <dd>A technology to make HTML look better</dd>
86
- </dl>
87
- <p>Suspendisse egestas sapien non felis placerat elementum. Morbi tortor nisl, suscipit sed mi sit amet, mollis malesuada nulla.
88
- Nulla facilisi. Nullam ac erat ante.</p>
89
- <h4>Fourth level</h4>
90
- <p>Nulla efficitur eleifend nisi, sit amet bibendum sapien fringilla ac. Mauris euismod metus a tellus laoreet, at elementum
91
- ex efficitur.</p>
92
- <p>Maecenas eleifend sollicitudin dui, faucibus sollicitudin augue cursus non. Ut finibus eleifend arcu ut vehicula. Mauris
93
- eu est maximus est porta condimentum in eu justo. Nulla id iaculis sapien.</p>
94
- <small>Sometimes you need small text to display things like date created</small>
95
- <p>Phasellus porttitor enim id metus volutpat ultricies. Ut nisi nunc, blandit sed dapibus at, vestibulum in felis. Etiam iaculis
96
- lorem ac nibh bibendum rhoncus. Nam interdum efficitur ligula sit amet ullamcorper. Etiam tristique, leo vitae porta faucibus,
97
- mi lacus laoreet metus, at cursus leo est vel tellus. Sed ac posuere est. Nunc ultricies nunc neque, vitae ultricies ex
98
- sodales quis. Aliquam eu nibh in libero accumsan pulvinar. Nullam nec nisl placerat, pretium metus vel, euismod ipsum.
99
- Proin tempor cursus nisl vel condimentum. Nam pharetra varius metus non pellentesque.</p>
100
- <h5>Fifth level</h5>
101
- <p>Aliquam sagittis rhoncus vulputate. Cras non luctus sem, sed tincidunt ligula. Vestibulum at nunc elit. Praesent aliquet
102
- ligula mi, in luctus elit volutpat porta. Phasellus molestie diam vel nisi sodales, a eleifend augue laoreet. Sed nec eleifend
103
- justo. Nam et sollicitudin odio.</p>
104
- <h6>Sixth level</h6>
105
- <p>Cras in nibh lacinia, venenatis nisi et, auctor urna. Donec pulvinar lacus sed diam dignissim, ut eleifend eros accumsan.
106
- Phasellus non tortor eros. Ut sed rutrum lacus. Etiam purus nunc, scelerisque quis enim vitae, malesuada ultrices turpis.
107
- Nunc vitae maximus purus, nec consectetur dui. Suspendisse euismod, elit vel rutrum commodo, ipsum tortor maximus dui,
108
- sed varius sapien odio vitae est. Etiam at cursus metus.</p>
109
- </React.Fragment>
110
- );
111
- }
112
- }
10
+ ```ts isFullscreen file="./SkipToContentBasic.tsx"
113
11
  ```
@@ -0,0 +1,128 @@
1
+ import React from 'react';
2
+ import { SkipToContent } from '@patternfly/react-core';
3
+
4
+ export const SkipToContentBasic: React.FunctionComponent = () => (
5
+ <React.Fragment>
6
+ <SkipToContent href="#main-content">Skip to content</SkipToContent>
7
+ <p>Press tab to skip to content at the bottom of the page.</p>
8
+ <div style={{ height: '2000px' }}></div>
9
+ <h1 id="main-content">Main content</h1>
10
+ <p>
11
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla accumsan, metus ultrices eleifend gravida, nulla
12
+ nunc varius lectus, nec rutrum justo nibh eu lectus. Ut vulputate semper dui. Fusce erat odio, sollicitudin vel
13
+ erat vel, interdum mattis neque. Sub works as well!
14
+ </p>
15
+ <h2>Second level</h2>
16
+ <p>
17
+ Curabitur accumsan turpis pharetra
18
+ <strong>augue tincidunt</strong> blandit. Quisque condimentum maximus mi, sit amet commodo arcu rutrum id. Proin
19
+ pretium urna vel cursus venenatis. Suspendisse potenti. Etiam mattis sem rhoncus lacus dapibus facilisis. Donec at
20
+ dignissim dui. Ut et neque nisl.
21
+ </p>
22
+ <ul>
23
+ <li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>
24
+ <li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>
25
+ <li>
26
+ Aliquam nec felis in sapien venenatis viverra fermentum nec lectus.
27
+ <ul>
28
+ <li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>
29
+ <li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>
30
+ <li>
31
+ Ut venenatis, nisl scelerisque.
32
+ <ol>
33
+ <li>Donec blandit a lorem id convallis.</li>
34
+ <li>Cras gravida arcu at diam gravida gravida.</li>
35
+ <li>Integer in volutpat libero.</li>
36
+ </ol>
37
+ </li>
38
+ </ul>
39
+ </li>
40
+ <li>Ut non enim metus.</li>
41
+ </ul>
42
+ <h3>Third level</h3>
43
+ <p>
44
+ Quisque ante lacus, malesuada ac auctor vitae, congue
45
+ <a href="#">non ante</a>. Phasellus lacus ex, semper ac tortor nec, fringilla condimentum orci. Fusce eu rutrum
46
+ tellus.
47
+ </p>
48
+ <ol>
49
+ <li>Donec blandit a lorem id convallis.</li>
50
+ <li>Cras gravida arcu at diam gravida gravida.</li>
51
+ <li>Integer in volutpat libero.</li>
52
+ <li>Donec a diam tellus.</li>
53
+ <li>
54
+ Etiam auctor nisl et.
55
+ <ul>
56
+ <li>Donec blandit a lorem id convallis.</li>
57
+ <li>Cras gravida arcu at diam gravida gravida.</li>
58
+ <li>
59
+ Integer in volutpat libero.
60
+ <ol>
61
+ <li>Donec blandit a lorem id convallis.</li>
62
+ <li>Cras gravida arcu at diam gravida gravida.</li>
63
+ </ol>
64
+ </li>
65
+ </ul>
66
+ </li>
67
+ <li>Aenean nec tortor orci.</li>
68
+ <li>Quisque aliquam cursus urna, non bibendum massa viverra eget.</li>
69
+ <li>Vivamus maximus ultricies pulvinar.</li>
70
+ </ol>
71
+ <blockquote>
72
+ Ut venenatis, nisl scelerisque sollicitudin fermentum, quam libero hendrerit ipsum, ut blandit est tellus sit amet
73
+ turpis.
74
+ </blockquote>
75
+ <p>
76
+ Quisque at semper enim, eu hendrerit odio. Etiam auctor nisl et
77
+ <em>justo sodales</em> elementum. Maecenas ultrices lacus quis neque consectetur, et lobortis nisi molestie.
78
+ </p>
79
+ <hr />
80
+ <p>
81
+ Sed sagittis enim ac tortor maximus rutrum. Nulla facilisi. Donec mattis vulputate risus in luctus. Maecenas
82
+ vestibulum interdum commodo.
83
+ </p>
84
+ <dl>
85
+ <dt>Web</dt>
86
+ <dd>The part of the internet that contains websites and web pages</dd>
87
+ <dt>HTML</dt>
88
+ <dd>A markup language for creating web pages</dd>
89
+ <dt>CSS</dt>
90
+ <dd>A technology to make HTML look better</dd>
91
+ </dl>
92
+ <p>
93
+ Suspendisse egestas sapien non felis placerat elementum. Morbi tortor nisl, suscipit sed mi sit amet, mollis
94
+ malesuada nulla. Nulla facilisi. Nullam ac erat ante.
95
+ </p>
96
+ <h4>Fourth level</h4>
97
+ <p>
98
+ Nulla efficitur eleifend nisi, sit amet bibendum sapien fringilla ac. Mauris euismod metus a tellus laoreet, at
99
+ elementum ex efficitur.
100
+ </p>
101
+ <p>
102
+ Maecenas eleifend sollicitudin dui, faucibus sollicitudin augue cursus non. Ut finibus eleifend arcu ut vehicula.
103
+ Mauris eu est maximus est porta condimentum in eu justo. Nulla id iaculis sapien.
104
+ </p>
105
+ <small>Sometimes you need small text to display things like date created</small>
106
+ <p>
107
+ Phasellus porttitor enim id metus volutpat ultricies. Ut nisi nunc, blandit sed dapibus at, vestibulum in felis.
108
+ Etiam iaculis lorem ac nibh bibendum rhoncus. Nam interdum efficitur ligula sit amet ullamcorper. Etiam tristique,
109
+ leo vitae porta faucibus, mi lacus laoreet metus, at cursus leo est vel tellus. Sed ac posuere est. Nunc ultricies
110
+ nunc neque, vitae ultricies ex sodales quis. Aliquam eu nibh in libero accumsan pulvinar. Nullam nec nisl
111
+ placerat, pretium metus vel, euismod ipsum. Proin tempor cursus nisl vel condimentum. Nam pharetra varius metus
112
+ non pellentesque.
113
+ </p>
114
+ <h5>Fifth level</h5>
115
+ <p>
116
+ Aliquam sagittis rhoncus vulputate. Cras non luctus sem, sed tincidunt ligula. Vestibulum at nunc elit. Praesent
117
+ aliquet ligula mi, in luctus elit volutpat porta. Phasellus molestie diam vel nisi sodales, a eleifend augue
118
+ laoreet. Sed nec eleifend justo. Nam et sollicitudin odio.
119
+ </p>
120
+ <h6>Sixth level</h6>
121
+ <p>
122
+ Cras in nibh lacinia, venenatis nisi et, auctor urna. Donec pulvinar lacus sed diam dignissim, ut eleifend eros
123
+ accumsan. Phasellus non tortor eros. Ut sed rutrum lacus. Etiam purus nunc, scelerisque quis enim vitae, malesuada
124
+ ultrices turpis. Nunc vitae maximus purus, nec consectetur dui. Suspendisse euismod, elit vel rutrum commodo,
125
+ ipsum tortor maximus dui, sed varius sapien odio vitae est. Etiam at cursus metus.
126
+ </p>
127
+ </React.Fragment>
128
+ );
@@ -9,265 +9,42 @@ propComponents: ['TextInput']
9
9
 
10
10
  ### Basic
11
11
 
12
- ```js
13
- import React from 'react';
14
- import { TextInput } from '@patternfly/react-core';
15
-
16
- class SimpleTextInput extends React.Component {
17
- constructor(props) {
18
- super(props);
19
- this.state = {
20
- value: ''
21
- };
22
- this.handleTextInputChange = value => {
23
- this.setState({ value });
24
- };
25
- }
26
-
27
- render() {
28
- const { value } = this.state;
29
-
30
- return (
31
- <TextInput value={value} type="text" onChange={this.handleTextInputChange} aria-label="text input example" />
32
- );
33
- }
34
- }
12
+ ```ts file="./TextInputBasic.tsx"
35
13
  ```
36
14
 
37
15
  ### Disabled
38
16
 
39
- ```js
40
- import React from 'react';
41
- import { TextInput } from '@patternfly/react-core';
42
-
43
- <TextInput
44
- value="disabled text input example"
45
- type="text"
46
- onChange={this.handleTextInputChange}
47
- aria-label="disabled text input example"
48
- isDisabled
49
- />;
17
+ ```ts file="./TextInputDisabled.tsx"
50
18
  ```
51
19
 
52
20
  ### Truncated on Left
53
21
 
54
- ```js
55
- import React from 'react';
56
- import { TextInput } from '@patternfly/react-core';
57
-
58
- class LeftTruncatedTextInput extends React.Component {
59
-
60
- constructor(props) {
61
- super(props);
62
- this.state = {
63
- value: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'
64
- };
65
- this.handleTextInputChange = value => {
66
- this.setState({ value });
67
- };
68
- }
69
-
70
- render() {
71
- const { value } = this.state;
72
- return (
73
- <TextInput isLeftTruncated value={value} type="text" onChange={this.handleTextInputChange} aria-label="left-truncated text input example" />
74
- );
75
- }
76
- }
22
+ ```ts file="./TextInputLeftTruncated.tsx"
77
23
  ```
78
24
 
79
25
  ### Read only
80
26
 
81
- ```js
82
- import React from 'react';
83
- import { Checkbox, TextInput } from '@patternfly/react-core';
84
-
85
- const ReadOnlyTextArea = () => {
86
- const [isPlainChecked, setIsPlainChecked] = React.useState(false);
87
-
88
- return (
89
- <React.Fragment>
90
- <div style={{ marginBottom: '12px' }}>
91
- <Checkbox
92
- id="isPlain"
93
- key="isPlain"
94
- label="Plain read only variant"
95
- isChecked={isPlainChecked}
96
- onChange={checked => setIsPlainChecked(checked)}
97
- />
98
- </div>
99
- <TextInput
100
- aria-label="read only text input example"
101
- value="read only text input example"
102
- readOnlyVariant={isPlainChecked ? 'plain' : 'default'}
103
- />
104
- </React.Fragment>
105
- );
106
- };
27
+ ```ts file="./TextInputReadOnly.tsx"
107
28
  ```
108
29
 
109
30
  ### Invalid
110
31
 
111
- ```js
112
- import React from 'react';
113
- import { TextInput, ValidatedOptions } from '@patternfly/react-core';
114
-
115
- class InvalidTextInput extends React.Component {
116
- constructor(props) {
117
- super(props);
118
- this.state = {
119
- value: ''
120
- };
121
- this.handleInvalidTextInputChange = value => {
122
- this.setState({ value });
123
- };
124
- }
125
-
126
- render() {
127
- const { value } = this.state;
128
-
129
- return (
130
- <TextInput
131
- value={value}
132
- onChange={this.handleInvalidTextInputChange}
133
- isRequired
134
- validated={ValidatedOptions.error}
135
- type="text"
136
- aria-label="invalid text input example"
137
- />
138
- );
139
- }
140
- }
32
+ ```ts file="./TextInputInvalid.tsx"
141
33
  ```
142
34
 
143
35
  ### Select text using ref
144
36
 
145
- ```js
146
- import React from 'react';
147
- import { TextInput } from '@patternfly/react-core';
148
-
149
- TextInputSelectAll = () => {
150
- const [value, setValue] = React.useState('select all on click');
151
- const ref = React.useRef(null);
152
- return (
153
- <TextInput
154
- ref={ref}
155
- value={value}
156
- onFocus={() => ref && ref.current && ref.current.select()}
157
- onChange={value => setValue(value)}
158
- aria-label="select-all"
159
- />
160
- );
161
- };
37
+ ```ts file="./TextInputSelectUsingRef.tsx"
162
38
  ```
163
39
 
164
40
  ### Icon variants
165
41
 
166
- ```js
167
- import React from 'react';
168
- import { TextInput } from '@patternfly/react-core';
169
-
170
- SimpleTextInput = () => {
171
- const [calendar, setCalendar] = React.useState('');
172
- const [clock, setClock] = React.useState('');
173
- const [custom, setCustom] = React.useState('');
174
-
175
- return (
176
- <>
177
- <TextInput
178
- value={calendar}
179
- type="text"
180
- iconVariant="calendar"
181
- onChange={value => setCalendar(value)}
182
- aria-label="text input example"
183
- />
184
- <br />
185
- <br />
186
- <TextInput
187
- value={clock}
188
- type="text"
189
- iconVariant="clock"
190
- onChange={value => setClock(value)}
191
- aria-label="text input example"
192
- />
193
- <br />
194
- <br />
195
- <TextInput
196
- value={custom}
197
- type="text"
198
- customIconDimensions="24px 24px"
199
- customIconUrl='data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"%3E%3Cpath fill="%23a18fff" d="M158.87.15c-16.16-1.52-31.2 8.42-35.33 24.12l-14.81 56.27c187.62 5.49 314.54 130.61 322.48 317l56.94-15.78c15.72-4.36 25.49-19.68 23.62-35.9C490.89 165.08 340.78 17.32 158.87.15zm-58.47 112L.55 491.64a16.21 16.21 0 0 0 20 19.75l379-105.1c-4.27-174.89-123.08-292.14-299.15-294.1zM128 416a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm48-152a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm104 104a32 32 0 1 1 32-32 32 32 0 0 1-32 32z"/%3E%3C/svg%3E'
200
- onChange={value => setCustom(value)}
201
- aria-label="text input example"
202
- />
203
- </>
204
- );
205
- };
42
+ ```ts file="./TextInputIcon.tsx"
206
43
  ```
207
44
 
208
45
  ### Icon sprite variants
209
46
 
210
47
  **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.
211
48
 
212
- ```js isBeta
213
- import React from 'react';
214
- import { TextInput } from '@patternfly/react-core';
215
-
216
- IconSpriteTextInputs = () => {
217
- const [success, setSuccess] = React.useState('');
218
- const [warning, setWarning] = React.useState('');
219
- const [error, setError] = React.useState('');
220
- const [calendar, setCalendar] = React.useState('');
221
- const [clock, setClock] = React.useState('');
222
-
223
- return (
224
- <>
225
- <TextInput
226
- validated={ValidatedOptions.success}
227
- isIconSprite
228
- type="text"
229
- onChange={value => setSuccess(value)}
230
- aria-label="success icon sprite text input example"
231
- />
232
- <br />
233
- <br />
234
- <TextInput
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
- <TextInput
244
- validated={ValidatedOptions.error}
245
- isIconSprite
246
- type="text"
247
- onChange={value => setError(value)}
248
- aria-label="error icon sprite text input example"
249
- />
250
- <br />
251
- <br />
252
- <TextInput
253
- value={calendar}
254
- isIconSprite
255
- type="text"
256
- iconVariant="calendar"
257
- onChange={value => setCalendar(value)}
258
- aria-label="calendar icon sprite text input example"
259
- />
260
- <br />
261
- <br />
262
- <TextInput
263
- value={clock}
264
- isIconSprite
265
- type="text"
266
- iconVariant="clock"
267
- onChange={value => setClock(value)}
268
- aria-label="clock icon sprite text input example"
269
- />
270
- </>
271
- );
272
- };
49
+ ```ts isBeta file="./TextInputIconSprite.tsx"
273
50
  ```
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { TextInput } from '@patternfly/react-core';
3
+
4
+ export const TextInputBasic: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState('');
6
+ return <TextInput value={value} type="text" onChange={value => setValue(value)} aria-label="text input example" />;
7
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { TextInput } from '@patternfly/react-core';
3
+
4
+ export const TextInputBasic: React.FunctionComponent = () => (
5
+ <TextInput value="disabled text input example" type="text" aria-label="disabled text input example" isDisabled />
6
+ );
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { TextInput } from '@patternfly/react-core';
3
+
4
+ export const TextInputIcon: React.FunctionComponent = () => {
5
+ const [calendar, setCalendar] = React.useState('');
6
+ const [clock, setClock] = React.useState('');
7
+ const [custom, setCustom] = React.useState('');
8
+
9
+ return (
10
+ <>
11
+ <TextInput
12
+ value={calendar}
13
+ type="text"
14
+ iconVariant="calendar"
15
+ onChange={value => setCalendar(value)}
16
+ aria-label="text input example"
17
+ />
18
+ <br />
19
+ <br />
20
+ <TextInput
21
+ value={clock}
22
+ type="text"
23
+ iconVariant="clock"
24
+ onChange={value => setClock(value)}
25
+ aria-label="text input example"
26
+ />
27
+ <br />
28
+ <br />
29
+ <TextInput
30
+ value={custom}
31
+ type="text"
32
+ customIconDimensions="24px 24px"
33
+ customIconUrl='data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"%3E%3Cpath fill="%23a18fff" d="M158.87.15c-16.16-1.52-31.2 8.42-35.33 24.12l-14.81 56.27c187.62 5.49 314.54 130.61 322.48 317l56.94-15.78c15.72-4.36 25.49-19.68 23.62-35.9C490.89 165.08 340.78 17.32 158.87.15zm-58.47 112L.55 491.64a16.21 16.21 0 0 0 20 19.75l379-105.1c-4.27-174.89-123.08-292.14-299.15-294.1zM128 416a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm48-152a32 32 0 1 1 32-32 32 32 0 0 1-32 32zm104 104a32 32 0 1 1 32-32 32 32 0 0 1-32 32z"/%3E%3C/svg%3E'
34
+ onChange={value => setCustom(value)}
35
+ aria-label="text input example"
36
+ />
37
+ </>
38
+ );
39
+ };
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { TextInput } from '@patternfly/react-core';
3
+
4
+ export const TextInputIconSprite: React.FunctionComponent = () => {
5
+ const [calendar, setCalendar] = React.useState('');
6
+ const [clock, setClock] = React.useState('');
7
+ const [success, setSuccess] = React.useState('');
8
+ const [warning, setWarning] = React.useState('');
9
+ const [error, setError] = React.useState('');
10
+
11
+ return (
12
+ <>
13
+ <TextInput
14
+ value={success}
15
+ validated={'success'}
16
+ isIconSprite
17
+ type="text"
18
+ onChange={value => setSuccess(value)}
19
+ aria-label="success icon sprite text input example"
20
+ />
21
+ <br />
22
+ <br />
23
+ <TextInput
24
+ value={warning}
25
+ validated={'warning'}
26
+ isIconSprite
27
+ type="text"
28
+ onChange={value => setWarning(value)}
29
+ aria-label="warning icon sprite text input example"
30
+ />
31
+ <br />
32
+ <br />
33
+ <TextInput
34
+ value={error}
35
+ validated={'error'}
36
+ isIconSprite
37
+ type="text"
38
+ onChange={value => setError(value)}
39
+ aria-label="error icon sprite text input example"
40
+ />
41
+ <br />
42
+ <br />
43
+ <TextInput
44
+ value={calendar}
45
+ isIconSprite
46
+ type="text"
47
+ iconVariant="calendar"
48
+ onChange={value => setCalendar(value)}
49
+ aria-label="calendar icon sprite text input example"
50
+ />
51
+ <br />
52
+ <br />
53
+ <TextInput
54
+ value={clock}
55
+ isIconSprite
56
+ type="text"
57
+ iconVariant="clock"
58
+ onChange={value => setClock(value)}
59
+ aria-label="clock icon sprite text input example"
60
+ />
61
+ </>
62
+ );
63
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { TextInput, ValidatedOptions } from '@patternfly/react-core';
3
+
4
+ export const TextInputInvalid: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState('');
6
+ return (
7
+ <TextInput
8
+ value={value}
9
+ onChange={value => setValue(value)}
10
+ isRequired
11
+ validated={ValidatedOptions.error}
12
+ type="text"
13
+ aria-label="invalid text input example"
14
+ />
15
+ );
16
+ };
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { TextInput } from '@patternfly/react-core';
3
+
4
+ export const LeftTruncatedTextInput: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState(
6
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'
7
+ );
8
+ return (
9
+ <TextInput
10
+ isLeftTruncated
11
+ value={value}
12
+ type="text"
13
+ onChange={value => setValue(value)}
14
+ aria-label="left-truncated text input example"
15
+ />
16
+ );
17
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { Checkbox, TextInput } from '@patternfly/react-core';
3
+
4
+ export const TextInputReadOnly: React.FunctionComponent = () => {
5
+ const [isPlainChecked, setIsPlainChecked] = React.useState(false);
6
+ return (
7
+ <>
8
+ <div style={{ marginBottom: '12px' }}>
9
+ <Checkbox
10
+ id="isPlain"
11
+ key="isPlain"
12
+ label="Plain read only variant"
13
+ isChecked={isPlainChecked}
14
+ onChange={checked => setIsPlainChecked(checked)}
15
+ />
16
+ </div>
17
+ <TextInput
18
+ value="read only text input example"
19
+ type="text"
20
+ readOnlyVariant={isPlainChecked ? 'plain' : 'default'}
21
+ aria-label="readonly input example"
22
+ />
23
+ </>
24
+ );
25
+ };
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { TextInput } from '@patternfly/react-core';
3
+
4
+ export const TextInputSelectUsingRef: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState('select all on click');
6
+ const ref = React.useRef<HTMLInputElement>(null);
7
+ return (
8
+ <TextInput
9
+ ref={ref}
10
+ value={value}
11
+ onFocus={() => ref?.current?.select()}
12
+ onChange={value => setValue(value)}
13
+ aria-label="select-all"
14
+ />
15
+ );
16
+ };