@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.
- package/CHANGELOG.md +6 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/Chip/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/DragDrop/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/Text/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/Tile/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
- package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
- package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
- package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
- package/dist/dynamic/deprecated/components/Select/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/favorites/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/next/components/package.json +1 -1
- package/dist/esm/components/Label/Label.d.ts +4 -2
- package/dist/esm/components/Label/Label.d.ts.map +1 -1
- package/dist/esm/components/Label/Label.js +19 -4
- package/dist/esm/components/Label/Label.js.map +1 -1
- package/dist/esm/components/Nav/NavList.d.ts +10 -4
- package/dist/esm/components/Nav/NavList.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavList.js +29 -8
- package/dist/esm/components/Nav/NavList.js.map +1 -1
- package/dist/js/components/Label/Label.d.ts +4 -2
- package/dist/js/components/Label/Label.d.ts.map +1 -1
- package/dist/js/components/Label/Label.js +19 -4
- package/dist/js/components/Label/Label.js.map +1 -1
- package/dist/js/components/Nav/NavList.d.ts +10 -4
- package/dist/js/components/Nav/NavList.d.ts.map +1 -1
- package/dist/js/components/Nav/NavList.js +29 -8
- package/dist/js/components/Nav/NavList.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/BackgroundImage/__tests__/BackgroundImage.test.tsx +21 -7
- package/src/components/BackgroundImage/__tests__/__snapshots__/BackgroundImage.test.tsx.snap +11 -0
- package/src/components/Label/Label.tsx +29 -3
- package/src/components/Label/__tests__/Label.test.tsx +35 -0
- package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +1 -0
- package/src/components/Label/examples/LabelFilled.tsx +220 -168
- package/src/components/Label/examples/LabelOutline.tsx +280 -226
- package/src/components/Nav/NavList.tsx +44 -12
- package/src/components/Nav/__tests__/__snapshots__/Nav.test.tsx.snap +10 -10
- 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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
Grey
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
color="blue"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
color="green"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
icon={<InfoCircleIcon />}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
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.
|
|
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.
|
|
168
|
+
aria-label={forwardScrollAriaLabel || ariaRightScroll}
|
|
169
|
+
onClick={this.scrollForward}
|
|
138
170
|
disabled={scrollViewAtEnd}
|
|
139
171
|
tabIndex={isSidebarOpen ? null : -1}
|
|
140
172
|
>
|