@patternfly/react-core 5.1.1-prerelease.19 → 5.1.1-prerelease.20

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 (149) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/Chip/package.json +1 -1
  21. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  22. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/DragDrop/package.json +1 -1
  28. package/dist/dynamic/components/Drawer/package.json +1 -1
  29. package/dist/dynamic/components/Dropdown/package.json +1 -1
  30. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  31. package/dist/dynamic/components/EmptyState/package.json +1 -1
  32. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  33. package/dist/dynamic/components/FileUpload/package.json +1 -1
  34. package/dist/dynamic/components/Form/package.json +1 -1
  35. package/dist/dynamic/components/FormSelect/package.json +1 -1
  36. package/dist/dynamic/components/HelperText/package.json +1 -1
  37. package/dist/dynamic/components/Hint/package.json +1 -1
  38. package/dist/dynamic/components/Icon/package.json +1 -1
  39. package/dist/dynamic/components/InputGroup/package.json +1 -1
  40. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  41. package/dist/dynamic/components/Label/package.json +1 -1
  42. package/dist/dynamic/components/List/package.json +1 -1
  43. package/dist/dynamic/components/LoginPage/package.json +1 -1
  44. package/dist/dynamic/components/Masthead/package.json +1 -1
  45. package/dist/dynamic/components/Menu/package.json +1 -1
  46. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  47. package/dist/dynamic/components/Modal/package.json +1 -1
  48. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  49. package/dist/dynamic/components/Nav/package.json +1 -1
  50. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  51. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  52. package/dist/dynamic/components/NumberInput/package.json +1 -1
  53. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  54. package/dist/dynamic/components/Page/package.json +1 -1
  55. package/dist/dynamic/components/Pagination/package.json +1 -1
  56. package/dist/dynamic/components/Panel/package.json +1 -1
  57. package/dist/dynamic/components/Popover/package.json +1 -1
  58. package/dist/dynamic/components/Progress/package.json +1 -1
  59. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  60. package/dist/dynamic/components/Radio/package.json +1 -1
  61. package/dist/dynamic/components/SearchInput/package.json +1 -1
  62. package/dist/dynamic/components/Select/package.json +1 -1
  63. package/dist/dynamic/components/Sidebar/package.json +1 -1
  64. package/dist/dynamic/components/SimpleList/package.json +1 -1
  65. package/dist/dynamic/components/Skeleton/package.json +1 -1
  66. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  67. package/dist/dynamic/components/Slider/package.json +1 -1
  68. package/dist/dynamic/components/Spinner/package.json +1 -1
  69. package/dist/dynamic/components/Switch/package.json +1 -1
  70. package/dist/dynamic/components/Tabs/package.json +1 -1
  71. package/dist/dynamic/components/Text/package.json +1 -1
  72. package/dist/dynamic/components/TextArea/package.json +1 -1
  73. package/dist/dynamic/components/TextInput/package.json +1 -1
  74. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  75. package/dist/dynamic/components/Tile/package.json +1 -1
  76. package/dist/dynamic/components/TimePicker/package.json +1 -1
  77. package/dist/dynamic/components/Timestamp/package.json +1 -1
  78. package/dist/dynamic/components/Title/package.json +1 -1
  79. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  80. package/dist/dynamic/components/Toolbar/package.json +1 -1
  81. package/dist/dynamic/components/Tooltip/package.json +1 -1
  82. package/dist/dynamic/components/TreeView/package.json +1 -1
  83. package/dist/dynamic/components/Truncate/package.json +1 -1
  84. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  85. package/dist/dynamic/components/Wizard/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
  90. package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
  91. package/dist/dynamic/deprecated/components/Select/package.json +1 -1
  92. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  93. package/dist/dynamic/deprecated/components/package.json +1 -1
  94. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  95. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  96. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  97. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  98. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  99. package/dist/dynamic/helpers/constants/package.json +1 -1
  100. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  101. package/dist/dynamic/helpers/favorites/package.json +1 -1
  102. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  103. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  104. package/dist/dynamic/helpers/package.json +1 -1
  105. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  106. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  107. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  108. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  109. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  110. package/dist/dynamic/helpers/util/package.json +1 -1
  111. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  112. package/dist/dynamic/layouts/Flex/package.json +1 -1
  113. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  114. package/dist/dynamic/layouts/Grid/package.json +1 -1
  115. package/dist/dynamic/layouts/Level/package.json +1 -1
  116. package/dist/dynamic/layouts/Split/package.json +1 -1
  117. package/dist/dynamic/layouts/Stack/package.json +1 -1
  118. package/dist/dynamic/next/components/package.json +1 -1
  119. package/dist/esm/components/Label/Label.d.ts +4 -2
  120. package/dist/esm/components/Label/Label.d.ts.map +1 -1
  121. package/dist/esm/components/Label/Label.js +19 -4
  122. package/dist/esm/components/Label/Label.js.map +1 -1
  123. package/dist/esm/components/Nav/NavList.d.ts +10 -4
  124. package/dist/esm/components/Nav/NavList.d.ts.map +1 -1
  125. package/dist/esm/components/Nav/NavList.js +29 -8
  126. package/dist/esm/components/Nav/NavList.js.map +1 -1
  127. package/dist/js/components/Label/Label.d.ts +4 -2
  128. package/dist/js/components/Label/Label.d.ts.map +1 -1
  129. package/dist/js/components/Label/Label.js +19 -4
  130. package/dist/js/components/Label/Label.js.map +1 -1
  131. package/dist/js/components/Nav/NavList.d.ts +10 -4
  132. package/dist/js/components/Nav/NavList.d.ts.map +1 -1
  133. package/dist/js/components/Nav/NavList.js +29 -8
  134. package/dist/js/components/Nav/NavList.js.map +1 -1
  135. package/dist/umd/react-core.min.js +1 -1
  136. package/helpers/package.json +1 -1
  137. package/layouts/package.json +1 -1
  138. package/next/package.json +1 -1
  139. package/package.json +2 -2
  140. package/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx +21 -7
  141. package/src/components/BackgroundImage/__tests__/__snapshots__/BackgroundImage.test.tsx.snap +11 -0
  142. package/src/components/Label/Label.tsx +29 -3
  143. package/src/components/Label/__tests__/Label.test.tsx +35 -0
  144. package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +1 -0
  145. package/src/components/Label/examples/LabelFilled.tsx +220 -168
  146. package/src/components/Label/examples/LabelOutline.tsx +280 -226
  147. package/src/components/Nav/NavList.tsx +44 -12
  148. package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +10 -10
  149. package/src/components/Page/__tests__/__snapshots__/Page.test.tsx.snap +6 -6
@@ -2,229 +2,283 @@ import React from 'react';
2
2
  import { Label } from '@patternfly/react-core';
3
3
  import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
4
4
 
5
- export const LabelOutline: React.FunctionComponent = () => (
6
- <React.Fragment>
7
- <Label variant="outline">Grey</Label>{' '}
8
- <Label variant="outline" icon={<InfoCircleIcon />}>
9
- Grey icon
10
- </Label>{' '}
11
- <Label variant="outline" onClose={() => Function.prototype}>
12
- Grey removable
13
- </Label>{' '}
14
- <Label variant="outline" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
15
- Grey icon removable
16
- </Label>{' '}
17
- <Label variant="outline" href="#outline">
18
- Grey link
19
- </Label>{' '}
20
- <Label variant="outline" href="#outline" onClose={() => Function.prototype}>
21
- Grey link removable
22
- </Label>
23
- <Label variant="outline" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
24
- Grey label with icon that overflows
25
- </Label>
26
- <br />
27
- <br />
28
- <Label variant="outline" color="blue">
29
- Blue
30
- </Label>{' '}
31
- <Label variant="outline" color="blue" icon={<InfoCircleIcon />}>
32
- Blue icon
33
- </Label>{' '}
34
- <Label variant="outline" color="blue" onClose={() => Function.prototype}>
35
- Blue removable
36
- </Label>{' '}
37
- <Label variant="outline" color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
38
- Blue icon removable
39
- </Label>{' '}
40
- <Label variant="outline" color="blue" href="#outline">
41
- Blue link
42
- </Label>{' '}
43
- <Label variant="outline" color="blue" href="#outline" onClose={() => Function.prototype}>
44
- Blue link removable
45
- </Label>
46
- <Label
47
- variant="outline"
48
- color="blue"
49
- icon={<InfoCircleIcon />}
50
- onClose={() => Function.prototype}
51
- textMaxWidth="16ch"
52
- >
53
- Blue label with icon that overflows
54
- </Label>
55
- <br />
56
- <br />
57
- <Label variant="outline" color="green">
58
- Green
59
- </Label>{' '}
60
- <Label variant="outline" color="green" icon={<InfoCircleIcon />}>
61
- Green icon
62
- </Label>{' '}
63
- <Label variant="outline" color="green" onClose={() => Function.prototype}>
64
- Green removable
65
- </Label>{' '}
66
- <Label variant="outline" color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
67
- Green icon removable
68
- </Label>{' '}
69
- <Label variant="outline" color="green" href="#outline">
70
- Green link
71
- </Label>{' '}
72
- <Label variant="outline" color="green" href="#outline" onClose={() => Function.prototype}>
73
- Green link removable
74
- </Label>
75
- <Label
76
- variant="outline"
77
- color="green"
78
- icon={<InfoCircleIcon />}
79
- onClose={() => Function.prototype}
80
- textMaxWidth="16ch"
81
- >
82
- Green label with icon that overflows
83
- </Label>
84
- <br />
85
- <br />
86
- <Label variant="outline" color="orange">
87
- Orange
88
- </Label>{' '}
89
- <Label variant="outline" color="orange" icon={<InfoCircleIcon />}>
90
- Orange icon
91
- </Label>{' '}
92
- <Label variant="outline" color="orange" onClose={() => Function.prototype}>
93
- Orange removable
94
- </Label>{' '}
95
- <Label variant="outline" color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
96
- Orange icon removable
97
- </Label>{' '}
98
- <Label variant="outline" color="orange" href="#outline">
99
- Orange link
100
- </Label>{' '}
101
- <Label variant="outline" color="orange" href="#outline" onClose={() => Function.prototype}>
102
- Orange link removable
103
- </Label>
104
- <Label
105
- variant="outline"
106
- color="orange"
107
- icon={<InfoCircleIcon />}
108
- onClose={() => Function.prototype}
109
- textMaxWidth="16ch"
110
- >
111
- Orange label with icon that overflows
112
- </Label>
113
- <br />
114
- <br />
115
- <Label variant="outline" color="red">
116
- Red
117
- </Label>{' '}
118
- <Label variant="outline" color="red" icon={<InfoCircleIcon />}>
119
- Red icon
120
- </Label>{' '}
121
- <Label variant="outline" color="red" onClose={() => Function.prototype}>
122
- Red removable
123
- </Label>{' '}
124
- <Label variant="outline" color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
125
- Red icon removable
126
- </Label>{' '}
127
- <Label variant="outline" color="red" href="#outline">
128
- Red link
129
- </Label>{' '}
130
- <Label variant="outline" color="red" href="#outline" onClose={() => Function.prototype}>
131
- Red link removable
132
- </Label>
133
- <Label
134
- variant="outline"
135
- color="red"
136
- icon={<InfoCircleIcon />}
137
- onClose={() => Function.prototype}
138
- textMaxWidth="16ch"
139
- >
140
- Red label with icon that overflows
141
- </Label>
142
- <br />
143
- <br />
144
- <Label variant="outline" color="purple">
145
- Purple
146
- </Label>{' '}
147
- <Label variant="outline" color="purple" icon={<InfoCircleIcon />}>
148
- Purple icon
149
- </Label>{' '}
150
- <Label variant="outline" color="purple" onClose={() => Function.prototype}>
151
- Purple removable
152
- </Label>{' '}
153
- <Label variant="outline" color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
154
- Purple icon removable
155
- </Label>{' '}
156
- <Label variant="outline" color="purple" href="#outline">
157
- Purple link
158
- </Label>{' '}
159
- <Label variant="outline" color="purple" href="#outline" onClose={() => Function.prototype}>
160
- Purple link removable
161
- </Label>
162
- <Label
163
- variant="outline"
164
- color="purple"
165
- icon={<InfoCircleIcon />}
166
- onClose={() => Function.prototype}
167
- textMaxWidth="16ch"
168
- >
169
- Purple label with icon that overflows
170
- </Label>
171
- <br />
172
- <br />
173
- <Label variant="outline" color="cyan">
174
- Cyan
175
- </Label>{' '}
176
- <Label variant="outline" color="cyan" icon={<InfoCircleIcon />}>
177
- Cyan icon
178
- </Label>{' '}
179
- <Label variant="outline" color="cyan" onClose={() => Function.prototype}>
180
- Cyan removable
181
- </Label>{' '}
182
- <Label variant="outline" color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
183
- Cyan icon removable
184
- </Label>{' '}
185
- <Label variant="outline" color="cyan" href="#outline">
186
- Cyan link
187
- </Label>{' '}
188
- <Label variant="outline" color="cyan" href="#outline" onClose={() => Function.prototype}>
189
- Cyan link removable
190
- </Label>
191
- <Label
192
- variant="outline"
193
- color="cyan"
194
- icon={<InfoCircleIcon />}
195
- onClose={() => Function.prototype}
196
- textMaxWidth="16ch"
197
- >
198
- Cyan label with icon that overflows
199
- </Label>
200
- <br />
201
- <br />
202
- <Label variant="outline" color="gold">
203
- Gold
204
- </Label>{' '}
205
- <Label variant="outline" color="gold" icon={<InfoCircleIcon />}>
206
- Gold icon
207
- </Label>{' '}
208
- <Label variant="outline" color="gold" onClose={() => Function.prototype}>
209
- Gold removable
210
- </Label>{' '}
211
- <Label variant="outline" color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
212
- Gold icon removable
213
- </Label>{' '}
214
- <Label variant="outline" color="gold" href="#outline">
215
- Gold link
216
- </Label>{' '}
217
- <Label variant="outline" color="gold" href="#outline" onClose={() => Function.prototype}>
218
- Gold link removable
219
- </Label>
220
- <Label
221
- variant="outline"
222
- color="gold"
223
- icon={<InfoCircleIcon />}
224
- onClose={() => Function.prototype}
225
- textMaxWidth="16ch"
226
- >
227
- Gold label with icon that overflows
228
- </Label>
229
- </React.Fragment>
230
- );
5
+ export const LabelOutline: React.FunctionComponent = () => {
6
+ const logColor = (color: string) => {
7
+ // eslint-disable-next-line no-console
8
+ console.log(color, 'label clicked');
9
+ };
10
+ return (
11
+ <React.Fragment>
12
+ <Label variant="outline">Grey</Label>{' '}
13
+ <Label variant="outline" icon={<InfoCircleIcon />}>
14
+ Grey icon
15
+ </Label>{' '}
16
+ <Label variant="outline" onClose={() => Function.prototype}>
17
+ Grey removable
18
+ </Label>{' '}
19
+ <Label variant="outline" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
20
+ Grey icon removable
21
+ </Label>{' '}
22
+ <Label variant="outline" href="#outline">
23
+ Grey link
24
+ </Label>{' '}
25
+ <Label variant="outline" href="#outline" onClose={() => Function.prototype}>
26
+ Grey link removable
27
+ </Label>
28
+ <Label variant="outline" onClick={() => logColor('grey')}>
29
+ Grey clickable
30
+ </Label>{' '}
31
+ <Label variant="outline" onClick={() => logColor('grey')} onClose={() => Function.prototype}>
32
+ Grey clickable removable
33
+ </Label>
34
+ <Label variant="outline" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
35
+ Grey label with icon that overflows
36
+ </Label>
37
+ <br />
38
+ <br />
39
+ <Label variant="outline" color="blue">
40
+ Blue
41
+ </Label>{' '}
42
+ <Label variant="outline" color="blue" icon={<InfoCircleIcon />}>
43
+ Blue icon
44
+ </Label>{' '}
45
+ <Label variant="outline" color="blue" onClose={() => Function.prototype}>
46
+ Blue removable
47
+ </Label>{' '}
48
+ <Label variant="outline" color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
49
+ Blue icon removable
50
+ </Label>{' '}
51
+ <Label variant="outline" color="blue" href="#outline">
52
+ Blue link
53
+ </Label>{' '}
54
+ <Label variant="outline" color="blue" href="#outline" onClose={() => Function.prototype}>
55
+ Blue link removable
56
+ </Label>
57
+ <Label variant="outline" color="blue" onClick={() => logColor('blue')}>
58
+ Blue clickable
59
+ </Label>{' '}
60
+ <Label variant="outline" color="blue" onClick={() => logColor('blue')} onClose={() => Function.prototype}>
61
+ Blue clickable removable
62
+ </Label>
63
+ <Label
64
+ variant="outline"
65
+ color="blue"
66
+ icon={<InfoCircleIcon />}
67
+ onClose={() => Function.prototype}
68
+ textMaxWidth="16ch"
69
+ >
70
+ Blue label with icon that overflows
71
+ </Label>
72
+ <br />
73
+ <br />
74
+ <Label variant="outline" color="green">
75
+ Green
76
+ </Label>{' '}
77
+ <Label variant="outline" color="green" icon={<InfoCircleIcon />}>
78
+ Green icon
79
+ </Label>{' '}
80
+ <Label variant="outline" color="green" onClose={() => Function.prototype}>
81
+ Green removable
82
+ </Label>{' '}
83
+ <Label variant="outline" color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
84
+ Green icon removable
85
+ </Label>{' '}
86
+ <Label variant="outline" color="green" href="#outline">
87
+ Green link
88
+ </Label>{' '}
89
+ <Label variant="outline" color="green" href="#outline" onClose={() => Function.prototype}>
90
+ Green link removable
91
+ </Label>
92
+ <Label variant="outline" color="green" onClick={() => logColor('green')}>
93
+ Green clickable
94
+ </Label>{' '}
95
+ <Label variant="outline" color="green" onClick={() => logColor('green')} onClose={() => Function.prototype}>
96
+ Green clickable removable
97
+ </Label>
98
+ <Label
99
+ variant="outline"
100
+ color="green"
101
+ icon={<InfoCircleIcon />}
102
+ onClose={() => Function.prototype}
103
+ textMaxWidth="16ch"
104
+ >
105
+ Green label with icon that overflows
106
+ </Label>
107
+ <br />
108
+ <br />
109
+ <Label variant="outline" color="orange">
110
+ Orange
111
+ </Label>{' '}
112
+ <Label variant="outline" color="orange" icon={<InfoCircleIcon />}>
113
+ Orange icon
114
+ </Label>{' '}
115
+ <Label variant="outline" color="orange" onClose={() => Function.prototype}>
116
+ Orange removable
117
+ </Label>{' '}
118
+ <Label variant="outline" color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
119
+ Orange icon removable
120
+ </Label>{' '}
121
+ <Label variant="outline" color="orange" href="#outline">
122
+ Orange link
123
+ </Label>{' '}
124
+ <Label variant="outline" color="orange" href="#outline" onClose={() => Function.prototype}>
125
+ Orange link removable
126
+ </Label>
127
+ <Label variant="outline" color="orange" onClick={() => logColor('orange')}>
128
+ Orange clickable
129
+ </Label>{' '}
130
+ <Label variant="outline" color="orange" onClick={() => logColor('orange')} onClose={() => Function.prototype}>
131
+ Orange clickable removable
132
+ </Label>
133
+ <Label
134
+ variant="outline"
135
+ color="orange"
136
+ icon={<InfoCircleIcon />}
137
+ onClose={() => Function.prototype}
138
+ textMaxWidth="16ch"
139
+ >
140
+ Orange label with icon that overflows
141
+ </Label>
142
+ <br />
143
+ <br />
144
+ <Label variant="outline" color="red">
145
+ Red
146
+ </Label>{' '}
147
+ <Label variant="outline" color="red" icon={<InfoCircleIcon />}>
148
+ Red icon
149
+ </Label>{' '}
150
+ <Label variant="outline" color="red" onClose={() => Function.prototype}>
151
+ Red removable
152
+ </Label>{' '}
153
+ <Label variant="outline" color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
154
+ Red icon removable
155
+ </Label>{' '}
156
+ <Label variant="outline" color="red" href="#outline">
157
+ Red link
158
+ </Label>{' '}
159
+ <Label variant="outline" color="red" href="#outline" onClose={() => Function.prototype}>
160
+ Red link removable
161
+ </Label>
162
+ <Label variant="outline" color="red" onClick={() => logColor('red')}>
163
+ Red clickable
164
+ </Label>{' '}
165
+ <Label variant="outline" color="red" onClick={() => logColor('red')} onClose={() => Function.prototype}>
166
+ Red clickable removable
167
+ </Label>
168
+ <Label
169
+ variant="outline"
170
+ color="red"
171
+ icon={<InfoCircleIcon />}
172
+ onClose={() => Function.prototype}
173
+ textMaxWidth="16ch"
174
+ >
175
+ Red label with icon that overflows
176
+ </Label>
177
+ <br />
178
+ <br />
179
+ <Label variant="outline" color="purple">
180
+ Purple
181
+ </Label>{' '}
182
+ <Label variant="outline" color="purple" icon={<InfoCircleIcon />}>
183
+ Purple icon
184
+ </Label>{' '}
185
+ <Label variant="outline" color="purple" onClose={() => Function.prototype}>
186
+ Purple removable
187
+ </Label>{' '}
188
+ <Label variant="outline" color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
189
+ Purple icon removable
190
+ </Label>{' '}
191
+ <Label variant="outline" color="purple" href="#outline">
192
+ Purple link
193
+ </Label>{' '}
194
+ <Label variant="outline" color="purple" href="#outline" onClose={() => Function.prototype}>
195
+ Purple link removable
196
+ </Label>
197
+ <Label variant="outline" color="purple" onClick={() => logColor('purple')}>
198
+ Purple clickable
199
+ </Label>{' '}
200
+ <Label variant="outline" color="purple" onClick={() => logColor('purple')} onClose={() => Function.prototype}>
201
+ Purple clickable removable
202
+ </Label>
203
+ <Label
204
+ variant="outline"
205
+ color="purple"
206
+ icon={<InfoCircleIcon />}
207
+ onClose={() => Function.prototype}
208
+ textMaxWidth="16ch"
209
+ >
210
+ Purple label with icon that overflows
211
+ </Label>
212
+ <br />
213
+ <br />
214
+ <Label variant="outline" color="cyan">
215
+ Cyan
216
+ </Label>{' '}
217
+ <Label variant="outline" color="cyan" icon={<InfoCircleIcon />}>
218
+ Cyan icon
219
+ </Label>{' '}
220
+ <Label variant="outline" color="cyan" onClose={() => Function.prototype}>
221
+ Cyan removable
222
+ </Label>{' '}
223
+ <Label variant="outline" color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
224
+ Cyan icon removable
225
+ </Label>{' '}
226
+ <Label variant="outline" color="cyan" href="#outline">
227
+ Cyan link
228
+ </Label>{' '}
229
+ <Label variant="outline" color="cyan" href="#outline" onClose={() => Function.prototype}>
230
+ Cyan link removable
231
+ </Label>
232
+ <Label variant="outline" color="cyan" onClick={() => logColor('cyan')}>
233
+ Cyan clickable
234
+ </Label>{' '}
235
+ <Label variant="outline" color="cyan" onClick={() => logColor('cyan')} onClose={() => Function.prototype}>
236
+ Cyan clickable removable
237
+ </Label>
238
+ <Label
239
+ variant="outline"
240
+ color="cyan"
241
+ icon={<InfoCircleIcon />}
242
+ onClose={() => Function.prototype}
243
+ textMaxWidth="16ch"
244
+ >
245
+ Cyan label with icon that overflows
246
+ </Label>
247
+ <br />
248
+ <br />
249
+ <Label variant="outline" color="gold">
250
+ Gold
251
+ </Label>{' '}
252
+ <Label variant="outline" color="gold" icon={<InfoCircleIcon />}>
253
+ Gold icon
254
+ </Label>{' '}
255
+ <Label variant="outline" color="gold" onClose={() => Function.prototype}>
256
+ Gold removable
257
+ </Label>{' '}
258
+ <Label variant="outline" color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
259
+ Gold icon removable
260
+ </Label>{' '}
261
+ <Label variant="outline" color="gold" href="#outline">
262
+ Gold link
263
+ </Label>{' '}
264
+ <Label variant="outline" color="gold" href="#outline" onClose={() => Function.prototype}>
265
+ Gold link removable
266
+ </Label>
267
+ <Label variant="outline" color="gold" onClick={() => logColor('gold')}>
268
+ Gold clickable
269
+ </Label>{' '}
270
+ <Label variant="outline" color="gold" onClick={() => logColor('gold')} onClose={() => Function.prototype}>
271
+ Gold clickable removable
272
+ </Label>
273
+ <Label
274
+ variant="outline"
275
+ color="gold"
276
+ icon={<InfoCircleIcon />}
277
+ onClose={() => Function.prototype}
278
+ textMaxWidth="16ch"
279
+ >
280
+ Gold label with icon that overflows
281
+ </Label>
282
+ </React.Fragment>
283
+ );
284
+ };
@@ -14,10 +14,14 @@ export interface NavListProps
14
14
  children?: React.ReactNode;
15
15
  /** Additional classes added to the list */
16
16
  className?: string;
17
- /** Aria-label for the left scroll button */
17
+ /** @deprecated Please use backScrollAriaLabel. Aria-label for the left scroll button */
18
18
  ariaLeftScroll?: string;
19
- /** Aria-label for the right scroll button */
19
+ /** @deprecated Please use forwardScrollAriaLabel. Aria-label for the right scroll button */
20
20
  ariaRightScroll?: string;
21
+ /** Aria-label for the back scroll button */
22
+ backScrollAriaLabel?: string;
23
+ /** Aria-label for the forward scroll button */
24
+ forwardScrollAriaLabel?: string;
21
25
  }
22
26
 
23
27
  class NavList extends React.Component<NavListProps> {
@@ -26,8 +30,11 @@ class NavList extends React.Component<NavListProps> {
26
30
  context!: React.ContextType<typeof NavContext>;
27
31
  static defaultProps: NavListProps = {
28
32
  ariaLeftScroll: 'Scroll left',
29
- ariaRightScroll: 'Scroll right'
33
+ backScrollAriaLabel: 'Scroll back',
34
+ ariaRightScroll: 'Scroll right',
35
+ forwardScrollAriaLabel: 'Scroll foward'
30
36
  };
37
+ private direction = 'ltr';
31
38
 
32
39
  state = {
33
40
  scrollViewAtStart: false,
@@ -51,7 +58,7 @@ class NavList extends React.Component<NavListProps> {
51
58
  }
52
59
  };
53
60
 
54
- scrollLeft = () => {
61
+ scrollBack = () => {
55
62
  // find first Element that is fully in view on the left, then scroll to the element before it
56
63
  const container = this.navList.current;
57
64
  if (container) {
@@ -65,13 +72,19 @@ class NavList extends React.Component<NavListProps> {
65
72
  }
66
73
  }
67
74
  if (lastElementOutOfView) {
68
- container.scrollLeft -= lastElementOutOfView.scrollWidth;
75
+ if (this.direction === 'ltr') {
76
+ // LTR scrolls left to go back
77
+ container.scrollLeft -= lastElementOutOfView.scrollWidth;
78
+ } else {
79
+ // RTL scrolls right to go back
80
+ container.scrollLeft += lastElementOutOfView.scrollWidth;
81
+ }
69
82
  }
70
83
  this.handleScrollButtons();
71
84
  }
72
85
  };
73
86
 
74
- scrollRight = () => {
87
+ scrollForward = () => {
75
88
  // find last Element that is fully in view on the right, then scroll to the element after it
76
89
  const container = this.navList.current;
77
90
  if (container) {
@@ -85,7 +98,13 @@ class NavList extends React.Component<NavListProps> {
85
98
  }
86
99
  }
87
100
  if (firstElementOutOfView) {
88
- container.scrollLeft += firstElementOutOfView.scrollWidth;
101
+ if (this.direction === 'ltr') {
102
+ // LTR scrolls right to go forward
103
+ container.scrollLeft += firstElementOutOfView.scrollWidth;
104
+ } else {
105
+ // RTL scrolls left to go forward
106
+ container.scrollLeft -= firstElementOutOfView.scrollWidth;
107
+ }
89
108
  }
90
109
  this.handleScrollButtons();
91
110
  }
@@ -93,6 +112,7 @@ class NavList extends React.Component<NavListProps> {
93
112
 
94
113
  componentDidMount() {
95
114
  this.observer = getResizeObserver(this.navList.current, this.handleScrollButtons, true);
115
+ this.direction = getComputedStyle(this.navList.current).getPropertyValue('direction');
96
116
  this.handleScrollButtons();
97
117
  }
98
118
 
@@ -100,8 +120,20 @@ class NavList extends React.Component<NavListProps> {
100
120
  this.observer();
101
121
  }
102
122
 
123
+ componentDidUpdate() {
124
+ this.direction = getComputedStyle(this.navList.current).getPropertyValue('direction');
125
+ }
126
+
103
127
  render() {
104
- const { children, className, ariaLeftScroll, ariaRightScroll, ...props } = this.props;
128
+ const {
129
+ children,
130
+ className,
131
+ ariaLeftScroll,
132
+ ariaRightScroll,
133
+ backScrollAriaLabel,
134
+ forwardScrollAriaLabel,
135
+ ...props
136
+ } = this.props;
105
137
  const { scrollViewAtStart, scrollViewAtEnd } = this.state;
106
138
 
107
139
  return (
@@ -113,8 +145,8 @@ class NavList extends React.Component<NavListProps> {
113
145
  {isHorizontal && (
114
146
  <button
115
147
  className={css(styles.navScrollButton)}
116
- aria-label={ariaLeftScroll}
117
- onClick={this.scrollLeft}
148
+ aria-label={backScrollAriaLabel || ariaLeftScroll}
149
+ onClick={this.scrollBack}
118
150
  disabled={scrollViewAtStart}
119
151
  tabIndex={isSidebarOpen ? null : -1}
120
152
  >
@@ -133,8 +165,8 @@ class NavList extends React.Component<NavListProps> {
133
165
  {isHorizontal && (
134
166
  <button
135
167
  className={css(styles.navScrollButton)}
136
- aria-label={ariaRightScroll}
137
- onClick={this.scrollRight}
168
+ aria-label={forwardScrollAriaLabel || ariaRightScroll}
169
+ onClick={this.scrollForward}
138
170
  disabled={scrollViewAtEnd}
139
171
  tabIndex={isSidebarOpen ? null : -1}
140
172
  >