@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
@@ -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.18","private":true}
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}
@@ -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.18","private":true}
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.18","private":true}
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.19",
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": "262e474df57437fead3a7c4e995a96c68eb8f9ef"
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('has default className and src URL applied to style', () => {
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
- const backgroundImage = screen.getByTestId('test-id');
9
- const backgroundImageStyle = backgroundImage.getAttribute('style');
16
+ test('has src URL applied to style', () => {
17
+ render(<BackgroundImage src="/image/url.png" data-testid="test-id" />);
10
18
 
11
- expect(backgroundImage).toHaveClass('pf-v5-c-background-image');
12
- expect(backgroundImageStyle).toContain('--pf-v5-c-background-image--BackgroundImage');
13
- expect(backgroundImageStyle).toContain('/image/url.png');
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('has additional className when one is provided', () => {
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
  });
@@ -7,6 +7,7 @@ exports[`Label editable label 1`] = `
7
7
  >
8
8
  <button
9
9
  class="pf-v5-c-label__content"
10
+ type="button"
10
11
  >
11
12
  <span
12
13
  class="pf-v5-c-label__text"
@@ -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
- <React.Fragment>
7
- <Label>Grey</Label> <Label icon={<InfoCircleIcon />}>Grey icon</Label>{' '}
8
- <Label onClose={() => Function.prototype}>Grey removable</Label>{' '}
9
- <Label icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
10
- Grey icon removable
11
- </Label>{' '}
12
- <Label href="#filled">Grey link</Label>{' '}
13
- <Label href="#filled" onClose={() => Function.prototype}>
14
- Grey link removable
15
- </Label>
16
- <Label icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
17
- Grey label with icon that overflows
18
- </Label>
19
- <br />
20
- <br />
21
- <Label color="blue">Blue</Label>{' '}
22
- <Label color="blue" icon={<InfoCircleIcon />}>
23
- Blue icon
24
- </Label>{' '}
25
- <Label color="blue" onClose={() => Function.prototype}>
26
- Blue removable
27
- </Label>{' '}
28
- <Label color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
29
- Blue icon removable
30
- </Label>{' '}
31
- <Label color="blue" href="#filled">
32
- Blue link
33
- </Label>{' '}
34
- <Label color="blue" href="#filled" onClose={() => Function.prototype}>
35
- Blue link removable
36
- </Label>
37
- <Label color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
38
- Blue label with icon that overflows
39
- </Label>
40
- <br />
41
- <br />
42
- <Label color="green">Green</Label>{' '}
43
- <Label color="green" icon={<InfoCircleIcon />}>
44
- Green icon
45
- </Label>{' '}
46
- <Label color="green" onClose={() => Function.prototype}>
47
- Green removable
48
- </Label>{' '}
49
- <Label color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
50
- Green icon removable
51
- </Label>{' '}
52
- <Label color="green" href="#filled">
53
- Green link
54
- </Label>{' '}
55
- <Label color="green" href="#filled" onClose={() => Function.prototype}>
56
- Green link removable
57
- </Label>
58
- <Label color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
59
- Green label with icon that overflows
60
- </Label>
61
- <br />
62
- <br />
63
- <Label color="orange">Orange</Label>{' '}
64
- <Label color="orange" icon={<InfoCircleIcon />}>
65
- Orange icon
66
- </Label>{' '}
67
- <Label color="orange" onClose={() => Function.prototype}>
68
- Orange removable
69
- </Label>{' '}
70
- <Label color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
71
- Orange icon removable
72
- </Label>{' '}
73
- <Label color="orange" href="#filled">
74
- Orange link
75
- </Label>{' '}
76
- <Label color="orange" href="#filled" onClose={() => Function.prototype}>
77
- Orange link removable
78
- </Label>
79
- <Label color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
80
- Orange label with icon that overflows
81
- </Label>
82
- <br />
83
- <br />
84
- <Label color="red">Red</Label>{' '}
85
- <Label color="red" icon={<InfoCircleIcon />}>
86
- Red icon
87
- </Label>{' '}
88
- <Label color="red" onClose={() => Function.prototype}>
89
- Red removable
90
- </Label>{' '}
91
- <Label color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
92
- Red icon removable
93
- </Label>{' '}
94
- <Label color="red" href="#filled">
95
- Red link
96
- </Label>{' '}
97
- <Label color="red" href="#filled" onClose={() => Function.prototype}>
98
- Red link removable
99
- </Label>
100
- <Label color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
101
- Red label with icon that overflows
102
- </Label>
103
- <br />
104
- <br />
105
- <Label color="purple">Purple</Label>{' '}
106
- <Label color="purple" icon={<InfoCircleIcon />}>
107
- Purple icon
108
- </Label>{' '}
109
- <Label color="purple" onClose={() => Function.prototype}>
110
- Purple removable
111
- </Label>{' '}
112
- <Label color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
113
- Purple icon removable
114
- </Label>{' '}
115
- <Label color="purple" href="#filled">
116
- Purple link
117
- </Label>{' '}
118
- <Label color="purple" href="#filled" onClose={() => Function.prototype}>
119
- Purple link removable
120
- </Label>
121
- <Label color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
122
- Purple label with icon that overflows
123
- </Label>
124
- <br />
125
- <br />
126
- <Label color="cyan">Cyan</Label>{' '}
127
- <Label color="cyan" icon={<InfoCircleIcon />}>
128
- Cyan icon
129
- </Label>{' '}
130
- <Label color="cyan" onClose={() => Function.prototype}>
131
- Cyan removable
132
- </Label>{' '}
133
- <Label color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
134
- Cyan icon removable
135
- </Label>{' '}
136
- <Label color="cyan" href="#filled">
137
- Cyan link
138
- </Label>{' '}
139
- <Label color="cyan" href="#filled" onClose={() => Function.prototype}>
140
- Cyan link removable
141
- </Label>
142
- <Label color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
143
- Cyan label with icon that overflows
144
- </Label>
145
- <br />
146
- <br />
147
- <Label color="gold">Gold</Label>{' '}
148
- <Label color="gold" icon={<InfoCircleIcon />}>
149
- Gold icon
150
- </Label>{' '}
151
- <Label color="gold" onClose={() => Function.prototype}>
152
- Gold removable
153
- </Label>{' '}
154
- <Label color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
155
- Gold icon removable
156
- </Label>{' '}
157
- <Label color="gold" href="#filled">
158
- Gold link
159
- </Label>{' '}
160
- <Label color="gold" href="#filled" onClose={() => Function.prototype}>
161
- Gold link removable
162
- </Label>
163
- <Label color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
164
- Gold label with icon that overflows
165
- </Label>
166
- <br />
167
- <br />
168
- <div style={{ width: '250px' }}>
169
- <Label>Label that overflows its parent, but has no textMaxWidth on its own</Label>
170
- </div>
171
- </React.Fragment>
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
+ };