@patternfly/react-core 6.0.0-alpha.21 → 6.0.0-alpha.22

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 (151) 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/Modal/package.json +1 -1
  119. package/dist/dynamic/next/components/package.json +1 -1
  120. package/dist/dynamic/styles/package.json +1 -1
  121. package/dist/esm/components/Label/Label.d.ts +2 -4
  122. package/dist/esm/components/Label/Label.d.ts.map +1 -1
  123. package/dist/esm/components/Label/Label.js +10 -6
  124. package/dist/esm/components/Label/Label.js.map +1 -1
  125. package/dist/esm/components/Label/LabelGroup.d.ts.map +1 -1
  126. package/dist/esm/components/Label/LabelGroup.js +2 -2
  127. package/dist/esm/components/Label/LabelGroup.js.map +1 -1
  128. package/dist/js/components/Label/Label.d.ts +2 -4
  129. package/dist/js/components/Label/Label.d.ts.map +1 -1
  130. package/dist/js/components/Label/Label.js +10 -6
  131. package/dist/js/components/Label/Label.js.map +1 -1
  132. package/dist/js/components/Label/LabelGroup.d.ts.map +1 -1
  133. package/dist/js/components/Label/LabelGroup.js +2 -2
  134. package/dist/js/components/Label/LabelGroup.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/Label/Label.tsx +14 -9
  141. package/src/components/Label/LabelGroup.tsx +2 -1
  142. package/src/components/Label/__tests__/__snapshots__/Label.test.tsx.snap +7 -7
  143. package/src/components/Label/__tests__/__snapshots__/LabelGroup.test.tsx.snap +1 -1
  144. package/src/components/Label/examples/Label.css +6 -0
  145. package/src/components/Label/examples/Label.md +19 -3
  146. package/src/components/Label/examples/LabelCompact.tsx +35 -5
  147. package/src/components/Label/examples/LabelFilled.tsx +75 -47
  148. package/src/components/Label/examples/LabelGroupEditableAdd.tsx +1 -1
  149. package/src/components/Label/examples/LabelGroupEditableAddDropdown.tsx +1 -1
  150. package/src/components/Label/examples/LabelGroupEditableAddModal.tsx +1 -1
  151. package/src/components/Label/examples/LabelOutline.tsx +88 -48
@@ -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":"6.0.0-alpha.20","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":"6.0.0-alpha.21","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":"6.0.0-alpha.20","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":"6.0.0-alpha.21","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":"6.0.0-alpha.20","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":"6.0.0-alpha.21","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "6.0.0-alpha.21",
3
+ "version": "6.0.0-alpha.22",
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",
@@ -73,5 +73,5 @@
73
73
  "react": "^17 || ^18",
74
74
  "react-dom": "^17 || ^18"
75
75
  },
76
- "gitHead": "1794095e336814dc8ed16282e1bae4a171ebaa46"
76
+ "gitHead": "86a75d22746d3f69d3fe8aec947d39213e8b60d4"
77
77
  }
@@ -15,9 +15,9 @@ export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
15
15
  /** Additional classes added to the label. */
16
16
  className?: string;
17
17
  /** Color of the label. */
18
- color?: 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'grey' | 'gold';
18
+ color?: 'blue' | 'cyan' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'gold';
19
19
  /** Variant of the label. */
20
- variant?: 'outline' | 'filled';
20
+ variant?: 'outline' | 'filled' | 'overflow' | 'add';
21
21
  /** Flag indicating the label is compact. */
22
22
  isCompact?: boolean;
23
23
  /** @beta Flag indicating the label is editable. */
@@ -58,8 +58,6 @@ export interface LabelProps extends React.HTMLProps<HTMLSpanElement> {
58
58
  closeBtnProps?: any;
59
59
  /** 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. */
60
60
  href?: string;
61
- /** Flag indicating if the label is an overflow label. */
62
- isOverflowLabel?: boolean;
63
61
  /** Callback for when the label is clicked. This should not be passed in if the href or isEditable props are also passed in. */
64
62
  onClick?: (event: React.MouseEvent) => void;
65
63
  /** Forwards the label content and className to rendered function. Use this prop for react router support.*/
@@ -81,6 +79,7 @@ const colorStyles = {
81
79
  orange: styles.modifiers.orange,
82
80
  purple: styles.modifiers.purple,
83
81
  red: styles.modifiers.red,
82
+ orangered: styles.modifiers.orangered,
84
83
  gold: styles.modifiers.gold,
85
84
  grey: ''
86
85
  };
@@ -104,7 +103,6 @@ export const Label: React.FunctionComponent<LabelProps> = ({
104
103
  closeBtnAriaLabel,
105
104
  closeBtnProps,
106
105
  href,
107
- isOverflowLabel,
108
106
  render,
109
107
  ...props
110
108
  }: LabelProps) => {
@@ -113,6 +111,10 @@ export const Label: React.FunctionComponent<LabelProps> = ({
113
111
  const editableButtonRef = React.useRef<HTMLButtonElement>();
114
112
  const editableInputRef = React.useRef<HTMLInputElement>();
115
113
 
114
+ const isOverflowLabel = variant === 'overflow';
115
+ const isAddLabel = variant === 'add';
116
+ const isClickable = (onLabelClick && !isOverflowLabel && !isAddLabel) || href;
117
+
116
118
  React.useEffect(() => {
117
119
  document.addEventListener('mousedown', onDocMouseDown);
118
120
  document.addEventListener('keydown', onKeyDown);
@@ -198,12 +200,13 @@ export const Label: React.FunctionComponent<LabelProps> = ({
198
200
  }
199
201
  };
200
202
 
201
- const LabelComponent = (isOverflowLabel ? 'button' : 'span') as any;
203
+ const LabelComponent = (isOverflowLabel || isAddLabel ? 'button' : 'span') as any;
202
204
 
203
205
  const defaultButton = (
204
206
  <Button
205
207
  type="button"
206
208
  variant="plain"
209
+ hasNoPadding
207
210
  onClick={onClose}
208
211
  aria-label={closeBtnAriaLabel || `Close ${children}`}
209
212
  {...closeBtnProps}
@@ -253,7 +256,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
253
256
  let LabelComponentChildElement = 'span';
254
257
  if (href) {
255
258
  LabelComponentChildElement = 'a';
256
- } else if (isEditable || (onLabelClick && !isOverflowLabel)) {
259
+ } else if (isEditable || (onLabelClick && !isOverflowLabel && !isAddLabel)) {
257
260
  LabelComponentChildElement = 'button';
258
261
  }
259
262
 
@@ -265,7 +268,7 @@ export const Label: React.FunctionComponent<LabelProps> = ({
265
268
  const isButton = LabelComponentChildElement === 'button';
266
269
 
267
270
  const labelComponentChildProps = {
268
- className: css(styles.labelContent),
271
+ className: css(styles.labelContent, isClickable && styles.modifiers.clickable),
269
272
  ...(isTooltipVisible && { tabIndex: 0 }),
270
273
  ...(href && { href }),
271
274
  ...(isButton && clickableLabelProps),
@@ -313,9 +316,11 @@ export const Label: React.FunctionComponent<LabelProps> = ({
313
316
  isCompact && styles.modifiers.compact,
314
317
  isEditable && labelGrpStyles.modifiers.editable,
315
318
  isEditableActive && styles.modifiers.editableActive,
319
+ isClickable && styles.modifiers.clickable,
320
+ isAddLabel && styles.modifiers.add,
316
321
  className
317
322
  )}
318
- onClick={isOverflowLabel ? onLabelClick : undefined}
323
+ onClick={isOverflowLabel || isAddLabel ? onLabelClick : undefined}
319
324
  >
320
325
  {!isEditableActive && labelComponentChild}
321
326
  {!isEditableActive && onClose && button}
@@ -183,7 +183,7 @@ class LabelGroup extends React.Component<LabelGroupProps, LabelGroupState> {
183
183
  {numChildren > numLabels && (
184
184
  <li className={css(styles.labelGroupListItem)}>
185
185
  <Label
186
- isOverflowLabel
186
+ variant="overflow"
187
187
  onClick={this.toggleCollapse}
188
188
  className={css(isCompact && labelStyles.modifiers.compact)}
189
189
  >
@@ -205,6 +205,7 @@ class LabelGroup extends React.Component<LabelGroupProps, LabelGroupState> {
205
205
  <div className={css(styles.labelGroupClose)}>
206
206
  <Button
207
207
  variant="plain"
208
+ hasNoPadding
208
209
  aria-label={closeBtnAriaLabel}
209
210
  onClick={onClick}
210
211
  id={`remove_group_${id}`}
@@ -21,7 +21,7 @@ exports[`Label editable label 1`] = `
21
21
  <button
22
22
  aria-disabled="false"
23
23
  aria-label="Close Something"
24
- class="pf-v5-c-button pf-m-plain"
24
+ class="pf-v5-c-button pf-m-plain pf-m-no-padding"
25
25
  data-ouia-component-id="OUIA-Generated-Button-plain-3"
26
26
  data-ouia-component-type="PF5/Button"
27
27
  data-ouia-safe="true"
@@ -155,7 +155,7 @@ exports[`Label label with close button 1`] = `
155
155
  <button
156
156
  aria-disabled="false"
157
157
  aria-label="Close Something"
158
- class="pf-v5-c-button pf-m-plain"
158
+ class="pf-v5-c-button pf-m-plain pf-m-no-padding"
159
159
  data-ouia-component-id="OUIA-Generated-Button-plain-1"
160
160
  data-ouia-component-type="PF5/Button"
161
161
  data-ouia-safe="true"
@@ -200,7 +200,7 @@ exports[`Label label with close button and outline variant 1`] = `
200
200
  <button
201
201
  aria-disabled="false"
202
202
  aria-label="Close Something"
203
- class="pf-v5-c-button pf-m-plain"
203
+ class="pf-v5-c-button pf-m-plain pf-m-no-padding"
204
204
  data-ouia-component-id="OUIA-Generated-Button-plain-2"
205
205
  data-ouia-component-type="PF5/Button"
206
206
  data-ouia-safe="true"
@@ -336,10 +336,10 @@ exports[`Label label with grey color with outline variant 1`] = `
336
336
  exports[`Label label with href 1`] = `
337
337
  <DocumentFragment>
338
338
  <span
339
- class="pf-v5-c-label"
339
+ class="pf-v5-c-label pf-m-clickable"
340
340
  >
341
341
  <a
342
- class="pf-v5-c-label__content"
342
+ class="pf-v5-c-label__content pf-m-clickable"
343
343
  href="#"
344
344
  >
345
345
  <span
@@ -355,10 +355,10 @@ exports[`Label label with href 1`] = `
355
355
  exports[`Label label with href with outline variant 1`] = `
356
356
  <DocumentFragment>
357
357
  <span
358
- class="pf-v5-c-label pf-m-outline"
358
+ class="pf-v5-c-label pf-m-outline pf-m-clickable"
359
359
  >
360
360
  <a
361
- class="pf-v5-c-label__content"
361
+ class="pf-v5-c-label__content pf-m-clickable"
362
362
  href="#"
363
363
  >
364
364
  <span
@@ -255,7 +255,7 @@ exports[`LabelGroup label group with closable category 1`] = `
255
255
  aria-disabled="false"
256
256
  aria-label="Close label group"
257
257
  aria-labelledby="remove_group_pf-random-id-2 pf-random-id-2"
258
- class="pf-v5-c-button pf-m-plain"
258
+ class="pf-v5-c-button pf-m-plain pf-m-no-padding"
259
259
  data-ouia-component-id="OUIA-Generated-Button-plain-1"
260
260
  data-ouia-component-type="PF5/Button"
261
261
  data-ouia-safe="true"
@@ -0,0 +1,6 @@
1
+ #ws-react-c-label-filled-labels .pf-v5-c-label,
2
+ #ws-react-c-label-outlined-labels .pf-v5-c-label,
3
+ #ws-react-c-label-compact-labels .pf-v5-c-label {
4
+ margin-inline-end: var(--pf-t--global--spacer--sm);
5
+ margin-block-end: var(--pf-t--global--spacer--sm);
6
+ }
@@ -7,71 +7,86 @@ propComponents: ['Label', 'LabelGroup']
7
7
 
8
8
  import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-icon';
9
9
  import { Link } from '@reach/router';
10
+ import './Label.css';
10
11
 
11
12
  ## Examples
12
13
 
13
14
  ### Filled labels
14
15
 
15
16
  ```ts file="LabelFilled.tsx"
17
+
16
18
  ```
17
19
 
18
20
  ### Outlined labels
19
21
 
20
22
  ```ts file="LabelOutline.tsx"
23
+
21
24
  ```
22
25
 
23
26
  ### Compact labels
24
27
 
25
28
  ```ts file="LabelCompact.tsx"
29
+
26
30
  ```
27
31
 
28
32
  ### Label with router link
29
33
 
30
34
  ```ts file="LabelRouterLink.tsx"
35
+
31
36
  ```
32
37
 
33
38
  ### Editable labels
34
39
 
35
- Click or press either enter or space to begin editing a label. After editing, click outside the label or press enter again to complete the edit. To cancel an edit, press escape.
40
+ Click or press either enter or space to begin editing a label. After editing, click outside the label or press enter again to complete the edit. To cancel an edit, press escape.
36
41
 
37
42
  You can also customize any Label's close button aria-label as this example shows with `closeBtnAriaLabel`.
38
43
 
39
44
  ```ts file="LabelEditable.tsx" isBeta
40
- ```
41
45
 
46
+ ```
42
47
 
43
48
  ### Basic label group
44
- Use a label group when you have multiple labels to display at once.
49
+
50
+ Use a label group when you have multiple labels to display at once.
45
51
 
46
52
  ```ts file="LabelGroupBasic.tsx"
53
+
47
54
  ```
48
55
 
49
56
  ### Label group with overflow
57
+
50
58
  An overflow label can be added to the end of a group to save space when the number of labels exceeds some threshold. Click the overflow label to expand and collapse the group.
51
59
 
52
60
  ```ts file="LabelGroupOverflow.tsx"
61
+
53
62
  ```
54
63
 
55
64
  ### Label group with categories
65
+
56
66
  Use a category name to organize a set of labels
57
67
 
58
68
  ```ts file="LabelGroupCategory.tsx"
69
+
59
70
  ```
60
71
 
61
72
  ### Label group with removable categories
62
73
 
63
74
  ```ts file="LabelGroupCategoryRemovable.tsx"
75
+
64
76
  ```
65
77
 
66
78
  ### Vertical label group
79
+
67
80
  Labels in a group can also be stacked vertically. This example shows a verical label group with a category name and overflow.
68
81
 
69
82
  ```ts file="LabelGroupVerticalCategoryOverflowRemovable.tsx"
83
+
70
84
  ```
71
85
 
72
86
  ### Editable label group
73
87
 
74
88
  ```ts isBeta file="LabelGroupEditableLabels.tsx"
89
+
75
90
  ```
76
91
 
77
92
  ### Editable label group with add button
@@ -79,4 +94,5 @@ Labels in a group can also be stacked vertically. This example shows a verical l
79
94
  The contents of a label group can be modified by removing labels or adding new ones using the add button. For additional documentation that showcases adding a new label, see [label demos](/components/label/react-demos).
80
95
 
81
96
  ```ts isBeta file="LabelGroupEditableAdd.tsx"
97
+
82
98
  ```
@@ -4,24 +4,54 @@ import InfoCircleIcon from '@patternfly/react-icons/dist/esm/icons/info-circle-i
4
4
 
5
5
  export const LabelCompact: React.FunctionComponent = () => (
6
6
  <React.Fragment>
7
- <Label isCompact>Grey</Label>{' '}
7
+ <Label isCompact>Compact</Label>
8
8
  <Label isCompact icon={<InfoCircleIcon />}>
9
9
  Compact icon
10
- </Label>{' '}
10
+ </Label>
11
11
  <Label isCompact onClose={() => Function.prototype}>
12
12
  Compact removable
13
- </Label>{' '}
13
+ </Label>
14
14
  <Label isCompact icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
15
15
  Compact icon removable
16
- </Label>{' '}
16
+ </Label>
17
17
  <Label isCompact href="#compact">
18
18
  Compact link
19
- </Label>{' '}
19
+ </Label>
20
20
  <Label isCompact href="#compact" onClose={() => Function.prototype}>
21
21
  Compact link removable
22
22
  </Label>
23
23
  <Label isCompact icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
24
24
  Compact label with icon that overflows
25
25
  </Label>
26
+ <br />
27
+ <br />
28
+ <Label variant="outline" color="blue" isCompact>
29
+ Compact
30
+ </Label>
31
+ <Label variant="outline" color="blue" isCompact icon={<InfoCircleIcon />}>
32
+ Compact icon
33
+ </Label>
34
+ <Label variant="outline" color="blue" isCompact onClose={() => Function.prototype}>
35
+ Compact removable
36
+ </Label>
37
+ <Label variant="outline" color="blue" isCompact icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
38
+ Compact icon removable
39
+ </Label>
40
+ <Label variant="outline" color="blue" isCompact href="#compact">
41
+ Compact link
42
+ </Label>
43
+ <Label variant="outline" color="blue" isCompact href="#compact" onClose={() => Function.prototype}>
44
+ Compact link removable
45
+ </Label>
46
+ <Label
47
+ variant="outline"
48
+ color="blue"
49
+ isCompact
50
+ icon={<InfoCircleIcon />}
51
+ onClose={() => Function.prototype}
52
+ textMaxWidth="16ch"
53
+ >
54
+ Compact label with icon that overflows
55
+ </Label>
26
56
  </React.Fragment>
27
57
  );
@@ -9,16 +9,17 @@ export const LabelFilled: React.FunctionComponent = () => {
9
9
  };
10
10
  return (
11
11
  <React.Fragment>
12
- <Label>Grey</Label> <Label icon={<InfoCircleIcon />}>Grey icon</Label>{' '}
13
- <Label onClose={() => Function.prototype}>Grey removable</Label>{' '}
12
+ <Label>Grey</Label>
13
+ <Label icon={<InfoCircleIcon />}>Grey icon</Label>
14
+ <Label onClose={() => Function.prototype}>Grey removable</Label>
14
15
  <Label icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
15
16
  Grey icon removable
16
- </Label>{' '}
17
- <Label href="#filled">Grey link</Label>{' '}
17
+ </Label>
18
+ <Label href="#filled">Grey link</Label>
18
19
  <Label href="#filled" onClose={() => Function.prototype}>
19
20
  Grey link removable
20
21
  </Label>
21
- <Label onClick={() => logColor('grey')}>Grey clickable</Label>{' '}
22
+ <Label onClick={() => logColor('grey')}>Grey clickable</Label>
22
23
  <Label onClick={() => logColor('grey')} onClose={() => Function.prototype}>
23
24
  Grey clickable removable
24
25
  </Label>
@@ -27,25 +28,25 @@ export const LabelFilled: React.FunctionComponent = () => {
27
28
  </Label>
28
29
  <br />
29
30
  <br />
30
- <Label color="blue">Blue</Label>{' '}
31
+ <Label color="blue">Blue</Label>
31
32
  <Label color="blue" icon={<InfoCircleIcon />}>
32
33
  Blue icon
33
- </Label>{' '}
34
+ </Label>
34
35
  <Label color="blue" onClose={() => Function.prototype}>
35
36
  Blue removable
36
- </Label>{' '}
37
+ </Label>
37
38
  <Label color="blue" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
38
39
  Blue icon removable
39
- </Label>{' '}
40
+ </Label>
40
41
  <Label color="blue" href="#filled">
41
42
  Blue link
42
- </Label>{' '}
43
+ </Label>
43
44
  <Label color="blue" href="#filled" onClose={() => Function.prototype}>
44
45
  Blue link removable
45
46
  </Label>
46
47
  <Label color="blue" onClick={() => logColor('blue')}>
47
48
  Blue clickable
48
- </Label>{' '}
49
+ </Label>
49
50
  <Label color="blue" onClick={() => logColor('blue')} onClose={() => Function.prototype}>
50
51
  Blue clickable removable
51
52
  </Label>
@@ -54,25 +55,25 @@ export const LabelFilled: React.FunctionComponent = () => {
54
55
  </Label>
55
56
  <br />
56
57
  <br />
57
- <Label color="green">Green</Label>{' '}
58
+ <Label color="green">Green</Label>
58
59
  <Label color="green" icon={<InfoCircleIcon />}>
59
60
  Green icon
60
- </Label>{' '}
61
+ </Label>
61
62
  <Label color="green" onClose={() => Function.prototype}>
62
63
  Green removable
63
- </Label>{' '}
64
+ </Label>
64
65
  <Label color="green" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
65
66
  Green icon removable
66
- </Label>{' '}
67
+ </Label>
67
68
  <Label color="green" href="#filled">
68
69
  Green link
69
- </Label>{' '}
70
+ </Label>
70
71
  <Label color="green" href="#filled" onClose={() => Function.prototype}>
71
72
  Green link removable
72
73
  </Label>
73
74
  <Label color="green" onClick={() => logColor('green')}>
74
75
  Green clickable
75
- </Label>{' '}
76
+ </Label>
76
77
  <Label color="green" onClick={() => logColor('green')} onClose={() => Function.prototype}>
77
78
  Green clickable removable
78
79
  </Label>
@@ -81,25 +82,25 @@ export const LabelFilled: React.FunctionComponent = () => {
81
82
  </Label>
82
83
  <br />
83
84
  <br />
84
- <Label color="orange">Orange</Label>{' '}
85
+ <Label color="orange">Orange</Label>
85
86
  <Label color="orange" icon={<InfoCircleIcon />}>
86
87
  Orange icon
87
- </Label>{' '}
88
+ </Label>
88
89
  <Label color="orange" onClose={() => Function.prototype}>
89
90
  Orange removable
90
- </Label>{' '}
91
+ </Label>
91
92
  <Label color="orange" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
92
93
  Orange icon removable
93
- </Label>{' '}
94
+ </Label>
94
95
  <Label color="orange" href="#filled">
95
96
  Orange link
96
- </Label>{' '}
97
+ </Label>
97
98
  <Label color="orange" href="#filled" onClose={() => Function.prototype}>
98
99
  Orange link removable
99
100
  </Label>
100
101
  <Label color="orange" onClick={() => logColor('orange')}>
101
102
  Orange clickable
102
- </Label>{' '}
103
+ </Label>
103
104
  <Label color="orange" onClick={() => logColor('orange')} onClose={() => Function.prototype}>
104
105
  Orange clickable removable
105
106
  </Label>
@@ -108,25 +109,25 @@ export const LabelFilled: React.FunctionComponent = () => {
108
109
  </Label>
109
110
  <br />
110
111
  <br />
111
- <Label color="red">Red</Label>{' '}
112
+ <Label color="red">Red</Label>
112
113
  <Label color="red" icon={<InfoCircleIcon />}>
113
114
  Red icon
114
- </Label>{' '}
115
+ </Label>
115
116
  <Label color="red" onClose={() => Function.prototype}>
116
117
  Red removable
117
- </Label>{' '}
118
+ </Label>
118
119
  <Label color="red" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
119
120
  Red icon removable
120
- </Label>{' '}
121
+ </Label>
121
122
  <Label color="red" href="#filled">
122
123
  Red link
123
- </Label>{' '}
124
+ </Label>
124
125
  <Label color="red" href="#filled" onClose={() => Function.prototype}>
125
126
  Red link removable
126
127
  </Label>
127
128
  <Label color="red" onClick={() => logColor('red')}>
128
129
  Red clickable
129
- </Label>{' '}
130
+ </Label>
130
131
  <Label color="red" onClick={() => logColor('red')} onClose={() => Function.prototype}>
131
132
  Red clickable removable
132
133
  </Label>
@@ -135,25 +136,52 @@ export const LabelFilled: React.FunctionComponent = () => {
135
136
  </Label>
136
137
  <br />
137
138
  <br />
138
- <Label color="purple">Purple</Label>{' '}
139
+ <Label color="orangered">Orange red</Label>
140
+ <Label color="orangered" icon={<InfoCircleIcon />}>
141
+ Orange red icon
142
+ </Label>
143
+ <Label color="orangered" onClose={() => Function.prototype}>
144
+ Orange red removable
145
+ </Label>
146
+ <Label color="orangered" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
147
+ Orange red icon removable
148
+ </Label>
149
+ <Label color="orangered" href="#filled">
150
+ Orange red link
151
+ </Label>
152
+ <Label color="orangered" href="#filled" onClose={() => Function.prototype}>
153
+ Orange red link removable
154
+ </Label>
155
+ <Label color="orangered" onClick={() => logColor('orangered')}>
156
+ Orange red clickable
157
+ </Label>
158
+ <Label color="orangered" onClick={() => logColor('orangered')} onClose={() => Function.prototype}>
159
+ Orange red clickable removable
160
+ </Label>
161
+ <Label color="orangered" icon={<InfoCircleIcon />} onClose={() => Function.prototype} textMaxWidth="16ch">
162
+ Orange red label with icon that overflows
163
+ </Label>
164
+ <br />
165
+ <br />
166
+ <Label color="purple">Purple</Label>
139
167
  <Label color="purple" icon={<InfoCircleIcon />}>
140
168
  Purple icon
141
- </Label>{' '}
169
+ </Label>
142
170
  <Label color="purple" onClose={() => Function.prototype}>
143
171
  Purple removable
144
- </Label>{' '}
172
+ </Label>
145
173
  <Label color="purple" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
146
174
  Purple icon removable
147
- </Label>{' '}
175
+ </Label>
148
176
  <Label color="purple" href="#filled">
149
177
  Purple link
150
- </Label>{' '}
178
+ </Label>
151
179
  <Label color="purple" href="#filled" onClose={() => Function.prototype}>
152
180
  Purple link removable
153
181
  </Label>
154
182
  <Label color="purple" onClick={() => logColor('purple')}>
155
183
  Purple clickable
156
- </Label>{' '}
184
+ </Label>
157
185
  <Label color="purple" onClick={() => logColor('purple')} onClose={() => Function.prototype}>
158
186
  Purple clickable removable
159
187
  </Label>
@@ -162,25 +190,25 @@ export const LabelFilled: React.FunctionComponent = () => {
162
190
  </Label>
163
191
  <br />
164
192
  <br />
165
- <Label color="cyan">Cyan</Label>{' '}
193
+ <Label color="cyan">Cyan</Label>
166
194
  <Label color="cyan" icon={<InfoCircleIcon />}>
167
195
  Cyan icon
168
- </Label>{' '}
196
+ </Label>
169
197
  <Label color="cyan" onClose={() => Function.prototype}>
170
198
  Cyan removable
171
- </Label>{' '}
199
+ </Label>
172
200
  <Label color="cyan" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
173
201
  Cyan icon removable
174
- </Label>{' '}
202
+ </Label>
175
203
  <Label color="cyan" href="#filled">
176
204
  Cyan link
177
- </Label>{' '}
205
+ </Label>
178
206
  <Label color="cyan" href="#filled" onClose={() => Function.prototype}>
179
207
  Cyan link removable
180
208
  </Label>
181
209
  <Label color="cyan" onClick={() => logColor('cyan')}>
182
210
  Cyan clickable
183
- </Label>{' '}
211
+ </Label>
184
212
  <Label color="cyan" onClick={() => logColor('cyan')} onClose={() => Function.prototype}>
185
213
  Cyan clickable removable
186
214
  </Label>
@@ -189,25 +217,25 @@ export const LabelFilled: React.FunctionComponent = () => {
189
217
  </Label>
190
218
  <br />
191
219
  <br />
192
- <Label color="gold">Gold</Label>{' '}
220
+ <Label color="gold">Gold</Label>
193
221
  <Label color="gold" icon={<InfoCircleIcon />}>
194
222
  Gold icon
195
- </Label>{' '}
223
+ </Label>
196
224
  <Label color="gold" onClose={() => Function.prototype}>
197
225
  Gold removable
198
- </Label>{' '}
226
+ </Label>
199
227
  <Label color="gold" icon={<InfoCircleIcon />} onClose={() => Function.prototype}>
200
228
  Gold icon removable
201
- </Label>{' '}
229
+ </Label>
202
230
  <Label color="gold" href="#filled">
203
231
  Gold link
204
- </Label>{' '}
232
+ </Label>
205
233
  <Label color="gold" href="#filled" onClose={() => Function.prototype}>
206
234
  Gold link removable
207
235
  </Label>
208
236
  <Label color="gold" onClick={() => logColor('gold')}>
209
237
  Gold clickable
210
- </Label>{' '}
238
+ </Label>
211
239
  <Label color="gold" onClick={() => logColor('gold')} onClose={() => Function.prototype}>
212
240
  Gold clickable removable
213
241
  </Label>
@@ -56,7 +56,7 @@ export const LabelGroupEditableAdd: React.FunctionComponent = () => {
56
56
  numLabels={5}
57
57
  isEditable
58
58
  addLabelControl={
59
- <Label color="blue" variant="outline" isOverflowLabel onClick={onAdd}>
59
+ <Label variant="add" onClick={onAdd}>
60
60
  Add label
61
61
  </Label>
62
62
  }
@@ -102,7 +102,7 @@ export const LabelGroupEditableAddDropdown: React.FunctionComponent = () => {
102
102
 
103
103
  const toggle = (
104
104
  <div ref={toggleRef}>
105
- <Label color="blue" variant="outline" isOverflowLabel onClick={onToggleClick}>
105
+ <Label variant="overflow" onClick={onToggleClick}>
106
106
  Add label
107
107
  </Label>
108
108
  </div>