@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
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.1.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.1.1-prerelease.19","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.1.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.1.1-prerelease.19","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.1.1-prerelease.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.1.1-prerelease.19","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.1.1-prerelease.
|
|
3
|
+
"version": "5.1.1-prerelease.20",
|
|
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": "^17 || ^18",
|
|
71
71
|
"react-dom": "^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "cb50876387b44c969d092c3cfba35a15be4ec939"
|
|
74
74
|
}
|
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { BackgroundImage } from '../BackgroundImage';
|
|
4
|
+
import styles from '@patternfly/react-styles/css/components/BackgroundImage/background-image';
|
|
4
5
|
|
|
5
|
-
test(
|
|
6
|
+
test(`renders with default className ${styles.backgroundImage}`, () => {
|
|
6
7
|
render(<BackgroundImage src="/image/url.png" data-testid="test-id" />);
|
|
8
|
+
expect(screen.getByTestId('test-id')).toHaveClass(styles.backgroundImage, { exact: true });
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('spreads additional props', () => {
|
|
12
|
+
render(<BackgroundImage src="/image/url.png" data-testid="test-id" lang="en-US" />);
|
|
13
|
+
expect(screen.getByTestId('test-id')).toHaveProperty('lang');
|
|
14
|
+
});
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
test('has src URL applied to style', () => {
|
|
17
|
+
render(<BackgroundImage src="/image/url.png" data-testid="test-id" />);
|
|
10
18
|
|
|
11
|
-
expect(
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
expect(screen.getByTestId('test-id')).toHaveAttribute(
|
|
20
|
+
'style',
|
|
21
|
+
'--pf-v5-c-background-image--BackgroundImage: url(/image/url.png);'
|
|
22
|
+
);
|
|
14
23
|
});
|
|
15
24
|
|
|
16
|
-
test('
|
|
25
|
+
test('renders with custom className when one is provided', () => {
|
|
17
26
|
render(<BackgroundImage src="/image/url.png" className="another-class" data-testid="test-id" />);
|
|
18
27
|
|
|
19
28
|
expect(screen.getByTestId('test-id')).toHaveClass('another-class');
|
|
20
29
|
});
|
|
30
|
+
|
|
31
|
+
test('Matches the snapshot', () => {
|
|
32
|
+
const { asFragment } = render(<BackgroundImage src="/image/url.png" data-testid="test-id" />);
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Matches the snapshot 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="pf-v5-c-background-image"
|
|
7
|
+
data-testid="test-id"
|
|
8
|
+
style="--pf-v5-c-background-image--BackgroundImage: url(/image/url.png);"
|
|
9
|
+
/>
|
|
10
|
+
</DocumentFragment>
|
|
11
|
+
`;
|
|
@@ -55,10 +55,12 @@ export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
|
|
|
55
55
|
closeBtnAriaLabel?: string;
|
|
56
56
|
/** Additional properties for the default close button. */
|
|
57
57
|
closeBtnProps?: any;
|
|
58
|
-
/** Href for a label that is a link. If present, the label will change to an anchor element. */
|
|
58
|
+
/** Href for a label that is a link. If present, the label will change to an anchor element. This should not be passed in if the onClick prop is also passed in. */
|
|
59
59
|
href?: string;
|
|
60
|
-
/** Flag indicating if the label is an overflow label */
|
|
60
|
+
/** Flag indicating if the label is an overflow label. */
|
|
61
61
|
isOverflowLabel?: boolean;
|
|
62
|
+
/** Callback for when the label is clicked. This should not be passed in if the href or isEditable props are also passed in. */
|
|
63
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
62
64
|
/** Forwards the label content and className to rendered function. Use this prop for react router support.*/
|
|
63
65
|
render?: ({
|
|
64
66
|
className,
|
|
@@ -94,6 +96,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
94
96
|
tooltipPosition,
|
|
95
97
|
icon,
|
|
96
98
|
onClose,
|
|
99
|
+
onClick: onLabelClick,
|
|
97
100
|
onEditCancel,
|
|
98
101
|
onEditComplete,
|
|
99
102
|
closeBtn,
|
|
@@ -118,6 +121,20 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
118
121
|
};
|
|
119
122
|
});
|
|
120
123
|
|
|
124
|
+
React.useEffect(() => {
|
|
125
|
+
if (onLabelClick && href) {
|
|
126
|
+
// eslint-disable-next-line no-console
|
|
127
|
+
console.warn(
|
|
128
|
+
'Link labels cannot have onClick passed, this results in invalid HTML. Please remove either the href or onClick prop.'
|
|
129
|
+
);
|
|
130
|
+
} else if (onLabelClick && isEditable) {
|
|
131
|
+
// eslint-disable-next-line no-console
|
|
132
|
+
console.warn(
|
|
133
|
+
'Editable labels cannot have onClick passed, clicking starts the label edit process. Please remove either the isEditable or onClick prop.'
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}, [onLabelClick, href, isEditable]);
|
|
137
|
+
|
|
121
138
|
const onDocMouseDown = (event: MouseEvent) => {
|
|
122
139
|
if (
|
|
123
140
|
isEditableActive &&
|
|
@@ -235,14 +252,22 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
235
252
|
let LabelComponentChildElement = 'span';
|
|
236
253
|
if (href) {
|
|
237
254
|
LabelComponentChildElement = 'a';
|
|
238
|
-
} else if (isEditable) {
|
|
255
|
+
} else if (isEditable || (onLabelClick && !isOverflowLabel)) {
|
|
239
256
|
LabelComponentChildElement = 'button';
|
|
240
257
|
}
|
|
241
258
|
|
|
259
|
+
const clickableLabelProps = {
|
|
260
|
+
type: 'button',
|
|
261
|
+
onClick: onLabelClick
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const isButton = LabelComponentChildElement === 'button';
|
|
265
|
+
|
|
242
266
|
const labelComponentChildProps = {
|
|
243
267
|
className: css(styles.labelContent),
|
|
244
268
|
...(isTooltipVisible && { tabIndex: 0 }),
|
|
245
269
|
...(href && { href }),
|
|
270
|
+
...(isButton && clickableLabelProps),
|
|
246
271
|
...(isEditable && {
|
|
247
272
|
ref: editableButtonRef,
|
|
248
273
|
onClick: (e: React.MouseEvent) => {
|
|
@@ -289,6 +314,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
|
|
|
289
314
|
isEditableActive && styles.modifiers.editableActive,
|
|
290
315
|
className
|
|
291
316
|
)}
|
|
317
|
+
onClick={isOverflowLabel ? onLabelClick : undefined}
|
|
292
318
|
>
|
|
293
319
|
{!isEditableActive && labelComponentChild}
|
|
294
320
|
{!isEditableActive && onClose && button}
|
|
@@ -109,4 +109,39 @@ describe('Label', () => {
|
|
|
109
109
|
expect(screen.queryByRole('button', { name: 'Something' })).toBeNull();
|
|
110
110
|
expect(asFragment()).toMatchSnapshot();
|
|
111
111
|
});
|
|
112
|
+
|
|
113
|
+
test('a button is not rendered when onClick is not passed', () => {
|
|
114
|
+
render(<Label>Click me</Label>);
|
|
115
|
+
|
|
116
|
+
expect(screen.queryByRole(`button`)).not.toBeInTheDocument();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('a button is rendered when onClick is passed', () => {
|
|
120
|
+
const fn = jest.fn();
|
|
121
|
+
|
|
122
|
+
render(<Label onClick={fn}>Click me</Label>);
|
|
123
|
+
|
|
124
|
+
expect(screen.getByRole(`button`)).toBeVisible();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test('clickable label does not call the passed callback when it is not clicked', async () => {
|
|
128
|
+
const mockCallback = jest.fn();
|
|
129
|
+
|
|
130
|
+
render(<Label onClick={mockCallback}>Click me</Label>);
|
|
131
|
+
|
|
132
|
+
expect(mockCallback).not.toHaveBeenCalled();
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test('clickable label calls passed callback on click', async () => {
|
|
136
|
+
const mockCallback = jest.fn();
|
|
137
|
+
const user = userEvent.setup();
|
|
138
|
+
|
|
139
|
+
render(<Label onClick={mockCallback}>Click me</Label>);
|
|
140
|
+
|
|
141
|
+
const label = screen.getByRole('button');
|
|
142
|
+
|
|
143
|
+
await user.click(label);
|
|
144
|
+
|
|
145
|
+
expect(mockCallback).toBeCalledTimes(1);
|
|
146
|
+
});
|
|
112
147
|
});
|
|
@@ -2,171 +2,223 @@ 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 LabelFilled: React.FunctionComponent = () =>
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Grey
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
<Label
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
)
|
|
5
|
+
export const LabelFilled: 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>Grey</Label> <Label icon={<InfoCircleIcon />}>Grey icon</Label>{' '}
|
|
13
|
+
<Label onClose={() => Function.prototype}>Grey removable</Label>{' '}
|
|
14
|
+
<Label icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
15
|
+
Grey icon removable
|
|
16
|
+
</Label>{' '}
|
|
17
|
+
<Label href="#filled">Grey link</Label>{' '}
|
|
18
|
+
<Label href="#filled" onClose={() => Function.prototype}>
|
|
19
|
+
Grey link removable
|
|
20
|
+
</Label>
|
|
21
|
+
<Label onClick={() => logColor('grey')}>Grey clickable</Label>{' '}
|
|
22
|
+
<Label onClick={() => logColor('grey')} onClose={() => Function.prototype}>
|
|
23
|
+
Grey clickable removable
|
|
24
|
+
</Label>
|
|
25
|
+
<Label icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
26
|
+
Grey label with icon that overflows
|
|
27
|
+
</Label>
|
|
28
|
+
<br />
|
|
29
|
+
<br />
|
|
30
|
+
<Label color="blue">Blue</Label>{' '}
|
|
31
|
+
<Label color="blue" icon={<InfoCircleIcon />}>
|
|
32
|
+
Blue icon
|
|
33
|
+
</Label>{' '}
|
|
34
|
+
<Label color="blue" onClose={() => Function.prototype}>
|
|
35
|
+
Blue removable
|
|
36
|
+
</Label>{' '}
|
|
37
|
+
<Label color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
38
|
+
Blue icon removable
|
|
39
|
+
</Label>{' '}
|
|
40
|
+
<Label color="blue" href="#filled">
|
|
41
|
+
Blue link
|
|
42
|
+
</Label>{' '}
|
|
43
|
+
<Label color="blue" href="#filled" onClose={() => Function.prototype}>
|
|
44
|
+
Blue link removable
|
|
45
|
+
</Label>
|
|
46
|
+
<Label color="blue" onClick={() => logColor('blue')}>
|
|
47
|
+
Blue clickable
|
|
48
|
+
</Label>{' '}
|
|
49
|
+
<Label color="blue" onClick={() => logColor('blue')} onClose={() => Function.prototype}>
|
|
50
|
+
Blue clickable removable
|
|
51
|
+
</Label>
|
|
52
|
+
<Label color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
53
|
+
Blue label with icon that overflows
|
|
54
|
+
</Label>
|
|
55
|
+
<br />
|
|
56
|
+
<br />
|
|
57
|
+
<Label color="green">Green</Label>{' '}
|
|
58
|
+
<Label color="green" icon={<InfoCircleIcon />}>
|
|
59
|
+
Green icon
|
|
60
|
+
</Label>{' '}
|
|
61
|
+
<Label color="green" onClose={() => Function.prototype}>
|
|
62
|
+
Green removable
|
|
63
|
+
</Label>{' '}
|
|
64
|
+
<Label color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
65
|
+
Green icon removable
|
|
66
|
+
</Label>{' '}
|
|
67
|
+
<Label color="green" href="#filled">
|
|
68
|
+
Green link
|
|
69
|
+
</Label>{' '}
|
|
70
|
+
<Label color="green" href="#filled" onClose={() => Function.prototype}>
|
|
71
|
+
Green link removable
|
|
72
|
+
</Label>
|
|
73
|
+
<Label color="green" onClick={() => logColor('green')}>
|
|
74
|
+
Green clickable
|
|
75
|
+
</Label>{' '}
|
|
76
|
+
<Label color="green" onClick={() => logColor('green')} onClose={() => Function.prototype}>
|
|
77
|
+
Green clickable removable
|
|
78
|
+
</Label>
|
|
79
|
+
<Label color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
80
|
+
Green label with icon that overflows
|
|
81
|
+
</Label>
|
|
82
|
+
<br />
|
|
83
|
+
<br />
|
|
84
|
+
<Label color="orange">Orange</Label>{' '}
|
|
85
|
+
<Label color="orange" icon={<InfoCircleIcon />}>
|
|
86
|
+
Orange icon
|
|
87
|
+
</Label>{' '}
|
|
88
|
+
<Label color="orange" onClose={() => Function.prototype}>
|
|
89
|
+
Orange removable
|
|
90
|
+
</Label>{' '}
|
|
91
|
+
<Label color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
92
|
+
Orange icon removable
|
|
93
|
+
</Label>{' '}
|
|
94
|
+
<Label color="orange" href="#filled">
|
|
95
|
+
Orange link
|
|
96
|
+
</Label>{' '}
|
|
97
|
+
<Label color="orange" href="#filled" onClose={() => Function.prototype}>
|
|
98
|
+
Orange link removable
|
|
99
|
+
</Label>
|
|
100
|
+
<Label color="orange" onClick={() => logColor('orange')}>
|
|
101
|
+
Orange clickable
|
|
102
|
+
</Label>{' '}
|
|
103
|
+
<Label color="orange" onClick={() => logColor('orange')} onClose={() => Function.prototype}>
|
|
104
|
+
Orange clickable removable
|
|
105
|
+
</Label>
|
|
106
|
+
<Label color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
107
|
+
Orange label with icon that overflows
|
|
108
|
+
</Label>
|
|
109
|
+
<br />
|
|
110
|
+
<br />
|
|
111
|
+
<Label color="red">Red</Label>{' '}
|
|
112
|
+
<Label color="red" icon={<InfoCircleIcon />}>
|
|
113
|
+
Red icon
|
|
114
|
+
</Label>{' '}
|
|
115
|
+
<Label color="red" onClose={() => Function.prototype}>
|
|
116
|
+
Red removable
|
|
117
|
+
</Label>{' '}
|
|
118
|
+
<Label color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
119
|
+
Red icon removable
|
|
120
|
+
</Label>{' '}
|
|
121
|
+
<Label color="red" href="#filled">
|
|
122
|
+
Red link
|
|
123
|
+
</Label>{' '}
|
|
124
|
+
<Label color="red" href="#filled" onClose={() => Function.prototype}>
|
|
125
|
+
Red link removable
|
|
126
|
+
</Label>
|
|
127
|
+
<Label color="red" onClick={() => logColor('red')}>
|
|
128
|
+
Red clickable
|
|
129
|
+
</Label>{' '}
|
|
130
|
+
<Label color="red" onClick={() => logColor('red')} onClose={() => Function.prototype}>
|
|
131
|
+
Red clickable removable
|
|
132
|
+
</Label>
|
|
133
|
+
<Label color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
134
|
+
Red label with icon that overflows
|
|
135
|
+
</Label>
|
|
136
|
+
<br />
|
|
137
|
+
<br />
|
|
138
|
+
<Label color="purple">Purple</Label>{' '}
|
|
139
|
+
<Label color="purple" icon={<InfoCircleIcon />}>
|
|
140
|
+
Purple icon
|
|
141
|
+
</Label>{' '}
|
|
142
|
+
<Label color="purple" onClose={() => Function.prototype}>
|
|
143
|
+
Purple removable
|
|
144
|
+
</Label>{' '}
|
|
145
|
+
<Label color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
146
|
+
Purple icon removable
|
|
147
|
+
</Label>{' '}
|
|
148
|
+
<Label color="purple" href="#filled">
|
|
149
|
+
Purple link
|
|
150
|
+
</Label>{' '}
|
|
151
|
+
<Label color="purple" href="#filled" onClose={() => Function.prototype}>
|
|
152
|
+
Purple link removable
|
|
153
|
+
</Label>
|
|
154
|
+
<Label color="purple" onClick={() => logColor('purple')}>
|
|
155
|
+
Purple clickable
|
|
156
|
+
</Label>{' '}
|
|
157
|
+
<Label color="purple" onClick={() => logColor('purple')} onClose={() => Function.prototype}>
|
|
158
|
+
Purple clickable removable
|
|
159
|
+
</Label>
|
|
160
|
+
<Label color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
161
|
+
Purple label with icon that overflows
|
|
162
|
+
</Label>
|
|
163
|
+
<br />
|
|
164
|
+
<br />
|
|
165
|
+
<Label color="cyan">Cyan</Label>{' '}
|
|
166
|
+
<Label color="cyan" icon={<InfoCircleIcon />}>
|
|
167
|
+
Cyan icon
|
|
168
|
+
</Label>{' '}
|
|
169
|
+
<Label color="cyan" onClose={() => Function.prototype}>
|
|
170
|
+
Cyan removable
|
|
171
|
+
</Label>{' '}
|
|
172
|
+
<Label color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
173
|
+
Cyan icon removable
|
|
174
|
+
</Label>{' '}
|
|
175
|
+
<Label color="cyan" href="#filled">
|
|
176
|
+
Cyan link
|
|
177
|
+
</Label>{' '}
|
|
178
|
+
<Label color="cyan" href="#filled" onClose={() => Function.prototype}>
|
|
179
|
+
Cyan link removable
|
|
180
|
+
</Label>
|
|
181
|
+
<Label color="cyan" onClick={() => logColor('cyan')}>
|
|
182
|
+
Cyan clickable
|
|
183
|
+
</Label>{' '}
|
|
184
|
+
<Label color="cyan" onClick={() => logColor('cyan')} onClose={() => Function.prototype}>
|
|
185
|
+
Cyan clickable removable
|
|
186
|
+
</Label>
|
|
187
|
+
<Label color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
188
|
+
Cyan label with icon that overflows
|
|
189
|
+
</Label>
|
|
190
|
+
<br />
|
|
191
|
+
<br />
|
|
192
|
+
<Label color="gold">Gold</Label>{' '}
|
|
193
|
+
<Label color="gold" icon={<InfoCircleIcon />}>
|
|
194
|
+
Gold icon
|
|
195
|
+
</Label>{' '}
|
|
196
|
+
<Label color="gold" onClose={() => Function.prototype}>
|
|
197
|
+
Gold removable
|
|
198
|
+
</Label>{' '}
|
|
199
|
+
<Label color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
|
|
200
|
+
Gold icon removable
|
|
201
|
+
</Label>{' '}
|
|
202
|
+
<Label color="gold" href="#filled">
|
|
203
|
+
Gold link
|
|
204
|
+
</Label>{' '}
|
|
205
|
+
<Label color="gold" href="#filled" onClose={() => Function.prototype}>
|
|
206
|
+
Gold link removable
|
|
207
|
+
</Label>
|
|
208
|
+
<Label color="gold" onClick={() => logColor('gold')}>
|
|
209
|
+
Gold clickable
|
|
210
|
+
</Label>{' '}
|
|
211
|
+
<Label color="gold" onClick={() => logColor('gold')} onClose={() => Function.prototype}>
|
|
212
|
+
Gold clickable removable
|
|
213
|
+
</Label>
|
|
214
|
+
<Label color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
|
|
215
|
+
Gold label with icon that overflows
|
|
216
|
+
</Label>
|
|
217
|
+
<br />
|
|
218
|
+
<br />
|
|
219
|
+
<div style={{ width: '250px' }}>
|
|
220
|
+
<Label>Label that overflows its parent, but has no textMaxWidth on its own</Label>
|
|
221
|
+
</div>
|
|
222
|
+
</React.Fragment>
|
|
223
|
+
);
|
|
224
|
+
};
|