@patternfly/react-table 4.44.12 → 4.44.13

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 (67) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/esm/components/Table/Table.d.ts +2 -1
  3. package/dist/esm/components/Table/Table.d.ts.map +1 -1
  4. package/dist/esm/components/Table/Table.js.map +1 -1
  5. package/dist/esm/components/Table/TableTypes.d.ts +2 -1
  6. package/dist/esm/components/Table/TableTypes.d.ts.map +1 -1
  7. package/dist/esm/components/Table/TableTypes.js.map +1 -1
  8. package/dist/esm/components/Table/base/provider.d.ts +2 -2
  9. package/dist/esm/components/Table/base/types.d.ts +2 -2
  10. package/dist/esm/components/TableComposable/TableComposable.d.ts +1 -1
  11. package/dist/esm/components/TableComposable/Td.d.ts +1 -1
  12. package/dist/js/components/Table/Table.d.ts +2 -1
  13. package/dist/js/components/Table/Table.d.ts.map +1 -1
  14. package/dist/js/components/Table/Table.js.map +1 -1
  15. package/dist/js/components/Table/TableTypes.d.ts +2 -1
  16. package/dist/js/components/Table/TableTypes.d.ts.map +1 -1
  17. package/dist/js/components/Table/TableTypes.js.map +1 -1
  18. package/dist/js/components/Table/base/provider.d.ts +2 -2
  19. package/dist/js/components/Table/base/types.d.ts +2 -2
  20. package/dist/js/components/TableComposable/TableComposable.d.ts +1 -1
  21. package/dist/js/components/TableComposable/Td.d.ts +1 -1
  22. package/package.json +6 -6
  23. package/src/components/Table/Table.tsx +2 -1
  24. package/src/components/Table/TableTypes.tsx +2 -1
  25. package/src/components/Table/examples/LegacyTableActions.tsx +218 -0
  26. package/src/components/Table/examples/LegacyTableBasic.tsx +90 -0
  27. package/src/components/Table/examples/LegacyTableCellWidth.tsx +66 -0
  28. package/src/components/Table/examples/LegacyTableCompoundExpandable.tsx +175 -0
  29. package/src/components/Table/examples/LegacyTableControllingText.tsx +51 -0
  30. package/src/components/Table/examples/LegacyTableEmptyState.tsx +48 -0
  31. package/src/components/Table/examples/LegacyTableExpandable.tsx +172 -0
  32. package/src/components/Table/examples/LegacyTableFavoritable.tsx +157 -0
  33. package/src/components/Table/examples/LegacyTableHoverable.tsx +125 -0
  34. package/src/components/Table/examples/LegacyTableMisc.tsx +56 -0
  35. package/src/components/Table/examples/LegacyTableSelectable.tsx +124 -0
  36. package/src/components/Table/examples/LegacyTableSelectableRadio.tsx +54 -0
  37. package/src/components/Table/examples/LegacyTableSortable.tsx +120 -0
  38. package/src/components/Table/examples/LegacyTableSortableCustom.tsx +189 -0
  39. package/src/components/Table/examples/LegacyTableTextModifiers.tsx +31 -0
  40. package/src/components/Table/examples/LegacyTableTree.tsx +213 -0
  41. package/src/components/Table/examples/Table.md +83 -1848
  42. package/src/components/TableComposable/examples/ComposableTable.md +31 -2805
  43. package/src/components/TableComposable/examples/ComposableTableActions.tsx +163 -0
  44. package/src/components/TableComposable/examples/ComposableTableBasic.tsx +89 -0
  45. package/src/components/TableComposable/examples/ComposableTableCellWidth.tsx +56 -0
  46. package/src/components/TableComposable/examples/ComposableTableCompoundExpandable.tsx +103 -0
  47. package/src/components/TableComposable/examples/ComposableTableControllingText.tsx +51 -0
  48. package/src/components/TableComposable/examples/ComposableTableDraggable.tsx +170 -0
  49. package/src/components/TableComposable/examples/ComposableTableEmptyState.tsx +45 -0
  50. package/src/components/TableComposable/examples/ComposableTableExpandable.tsx +195 -0
  51. package/src/components/TableComposable/examples/ComposableTableFavoritable.tsx +118 -0
  52. package/src/components/TableComposable/examples/ComposableTableHoverable.tsx +67 -0
  53. package/src/components/TableComposable/examples/ComposableTableMisc.tsx +92 -0
  54. package/src/components/TableComposable/examples/ComposableTableMultipleStickyColumns.tsx +153 -0
  55. package/src/components/TableComposable/examples/ComposableTableNestedExpandable.tsx +127 -0
  56. package/src/components/TableComposable/examples/ComposableTableNestedHeaders.tsx +202 -0
  57. package/src/components/TableComposable/examples/ComposableTableSelectable.tsx +125 -0
  58. package/src/components/TableComposable/examples/ComposableTableSelectableRadio.tsx +68 -0
  59. package/src/components/TableComposable/examples/ComposableTableSortable.tsx +107 -0
  60. package/src/components/TableComposable/examples/ComposableTableSortableCustom.tsx +175 -0
  61. package/src/components/TableComposable/examples/ComposableTableStickyColumn.tsx +144 -0
  62. package/src/components/TableComposable/examples/ComposableTableStickyColumnsAndHeader.tsx +167 -0
  63. package/src/components/TableComposable/examples/ComposableTableTextModifiers.tsx +33 -0
  64. package/src/components/TableComposable/examples/ComposableTableTree.tsx +201 -0
  65. package/src/demos/Table.md +7 -6
  66. package/src/components/Table/examples/DemoSortableTable.js +0 -65
  67. package/src/components/TableComposable/examples/DemoSortableTable.js +0 -65
@@ -49,5 +49,5 @@ export interface TableComposableProps extends React.HTMLProps<HTMLTableElement>,
49
49
  /** Collection of column spans for nested headers */
50
50
  nestedHeaderColumnSpans?: number[];
51
51
  }
52
- export declare const TableComposable: React.ForwardRefExoticComponent<Pick<TableComposableProps, "span" | "wrap" | "content" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "variant" | "ouiaId" | "ouiaSafe" | "borders" | "isStickyHeader" | "gridBreakPoint" | "innerRef" | "isTreeTable" | "isNested" | "nestedHeaderColumnSpans"> & React.RefAttributes<HTMLTableElement>>;
52
+ export declare const TableComposable: React.ForwardRefExoticComponent<Pick<TableComposableProps, "span" | "wrap" | "content" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "variant" | "ouiaId" | "ouiaSafe" | "innerRef" | "borders" | "isStickyHeader" | "gridBreakPoint" | "isTreeTable" | "isNested" | "nestedHeaderColumnSpans"> & React.RefAttributes<HTMLTableElement>>;
53
53
  //# sourceMappingURL=TableComposable.d.ts.map
@@ -24,5 +24,5 @@ export interface TdProps extends BaseCellProps, Omit<React.HTMLProps<HTMLTableDa
24
24
  /** True to remove padding */
25
25
  noPadding?: boolean;
26
26
  }
27
- export declare const Td: React.ForwardRefExoticComponent<Pick<TdProps, "span" | "wrap" | "content" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "select" | "component" | "noPadding" | "innerRef" | "dataLabel" | "textCenter" | "modifier" | "visibility" | "actions" | "expand" | "treeRow" | "compoundExpand" | "favorites" | "draggableRow"> & React.RefAttributes<HTMLTableDataCellElement>>;
27
+ export declare const Td: React.ForwardRefExoticComponent<Pick<TdProps, "span" | "wrap" | "content" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "select" | "component" | "innerRef" | "noPadding" | "dataLabel" | "textCenter" | "modifier" | "visibility" | "actions" | "expand" | "treeRow" | "compoundExpand" | "favorites" | "draggableRow"> & React.RefAttributes<HTMLTableDataCellElement>>;
28
28
  //# sourceMappingURL=Td.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-table",
3
- "version": "4.44.12",
3
+ "version": "4.44.13",
4
4
  "description": "This library provides a set of React table components for use with the PatternFly 4",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -31,10 +31,10 @@
31
31
  "clean": "rimraf dist"
32
32
  },
33
33
  "dependencies": {
34
- "@patternfly/react-core": "^4.175.12",
35
- "@patternfly/react-icons": "^4.26.12",
36
- "@patternfly/react-styles": "^4.25.12",
37
- "@patternfly/react-tokens": "^4.27.12",
34
+ "@patternfly/react-core": "^4.175.13",
35
+ "@patternfly/react-icons": "^4.26.13",
36
+ "@patternfly/react-styles": "^4.25.13",
37
+ "@patternfly/react-tokens": "^4.27.13",
38
38
  "lodash": "^4.17.19",
39
39
  "tslib": "^2.0.0"
40
40
  },
@@ -46,5 +46,5 @@
46
46
  "react": "^16.8.0 || ^17.0.0",
47
47
  "react-dom": "^16.8.0 || ^17.0.0"
48
48
  },
49
- "gitHead": "c31cf1714bb3cbb692b22861c6c8204d59243d83"
49
+ "gitHead": "8e5443db20c851256e0f8a860c720ac98bac445e"
50
50
  }
@@ -32,6 +32,7 @@ import {
32
32
  OnFavorite
33
33
  } from './TableTypes';
34
34
  import { TreeRowWrapper } from './TreeRowWrapper';
35
+ import { CustomActionsToggleProps } from './ActionsColumn';
35
36
 
36
37
  export interface TableProps extends OUIAProps {
37
38
  /** Adds an accessible name for the Table */
@@ -89,7 +90,7 @@ export interface TableProps extends OUIAProps {
89
90
  /** The desired direction to show the dropdown when clicking on the actions Kebab. Can only be used together with `actions` property */
90
91
  dropdownDirection?: 'up' | 'down';
91
92
  /** The toggle of the actions menu dropdown. A KebabToggle or DropdownToggle component */
92
- actionsToggle?: React.ReactElement;
93
+ actionsToggle?: (props: CustomActionsToggleProps) => React.ReactNode;
93
94
  /** Row data */
94
95
  rows: (IRow | string[])[];
95
96
  /** Cell/column data */
@@ -7,6 +7,7 @@ import {
7
7
  } from '@patternfly/react-core/dist/esm/components/Dropdown/dropdownConstants';
8
8
  import * as React from 'react';
9
9
  import { CustomActionsToggleProps } from './ActionsColumn';
10
+ import { ButtonProps } from '@patternfly/react-core';
10
11
 
11
12
  export enum TableGridBreakpoint {
12
13
  none = '',
@@ -145,7 +146,7 @@ export interface ISortBy {
145
146
  defaultDirection?: 'asc' | 'desc';
146
147
  }
147
148
 
148
- export interface IAction extends Omit<DropdownItemProps, 'title' | 'onClick'> {
149
+ export interface IAction extends Omit<DropdownItemProps, 'title' | 'onClick'>, Pick<ButtonProps, 'variant'> {
149
150
  /** Flag indicating an item on actions menu is a separator, rather than an action */
150
151
  isSeparator?: boolean;
151
152
  /** Key of actions menu item */
@@ -0,0 +1,218 @@
1
+ /* eslint-disable no-console */
2
+ import React from 'react';
3
+ import {
4
+ ButtonVariant,
5
+ Checkbox,
6
+ DropdownToggle,
7
+ ToggleGroup,
8
+ ToggleGroupItem,
9
+ ToggleGroupItemProps,
10
+ Toolbar,
11
+ ToolbarContent,
12
+ ToolbarItem
13
+ } from '@patternfly/react-core';
14
+ import {
15
+ CustomActionsToggleProps,
16
+ headerCol,
17
+ TableProps,
18
+ IAction,
19
+ IActions,
20
+ IActionsResolver,
21
+ Table,
22
+ TableBody,
23
+ TableHeader
24
+ } from '@patternfly/react-table';
25
+
26
+ interface Repository {
27
+ name: string;
28
+ branches: string;
29
+ prs: string;
30
+ workspaces: string;
31
+ lastCommit: string;
32
+ }
33
+
34
+ type ExampleType = 'actions' | 'actionResolver';
35
+
36
+ export const LegacyTableActions: React.FunctionComponent = () => {
37
+ // In real usage, this data would come from some external source like an API via props.
38
+ const repositories: Repository[] = [
39
+ { name: 'a', branches: 'two', prs: '1', workspaces: 'four', lastCommit: 'five' },
40
+ { name: 'disable actions', branches: 'two', prs: '3', workspaces: 'four', lastCommit: 'five' },
41
+ { name: 'green actions', branches: 'two', prs: '4', workspaces: 'four', lastCommit: 'five' },
42
+ { name: 'extra action props', branches: 'two', prs: '5', workspaces: 'four', lastCommit: 'five' },
43
+ { name: 'blue actions', branches: 'two', prs: '6', workspaces: 'four', lastCommit: 'five' }
44
+ ];
45
+
46
+ // This state is just for the ToggleGroup in this example and isn't necessary for Table usage.
47
+ const [propToUse, setPropToUse] = React.useState<ExampleType>('actions');
48
+ const onPropToUseChange: ToggleGroupItemProps['onChange'] = (_isSelected, event) => {
49
+ const id = event.currentTarget.id;
50
+ setPropToUse(id as ExampleType);
51
+ };
52
+
53
+ const [useCustomToggle, setUseCustomToggle] = React.useState(false);
54
+ const [useExtraAction, setUseExtraAction] = React.useState(false);
55
+
56
+ const customActionsToggle = (props: CustomActionsToggleProps) => (
57
+ <DropdownToggle onToggle={props.onToggle} isDisabled={props.isDisabled}>
58
+ Actions
59
+ </DropdownToggle>
60
+ );
61
+
62
+ const columns: TableProps['cells'] = [
63
+ { title: 'Repositories', cellTransforms: [headerCol()] },
64
+ 'Branches',
65
+ 'Pull requests',
66
+ 'Workspaces',
67
+ 'Last commit'
68
+ ];
69
+ const rows: TableProps['rows'] = repositories.map(repo => {
70
+ const cells = [repo.name, repo.branches, repo.prs, repo.workspaces, repo.lastCommit];
71
+ // These rows have arbitrary differences for this example, but these could be based on some other conditions
72
+ if (repo.name === 'disable actions') {
73
+ return { cells, disableActions: true };
74
+ }
75
+ if (repo.name === 'green actions') {
76
+ return { cells, type: 'green' };
77
+ }
78
+ if (repo.name === 'extra action props') {
79
+ return { cells, actionProps: { 'data-specific-attr': 'some-value' } };
80
+ }
81
+ if (repo.name === 'blue actions') {
82
+ return { cells, type: 'blue' };
83
+ }
84
+ return { cells };
85
+ });
86
+
87
+ /**
88
+ * Use actions or actionResolver, not both
89
+ */
90
+ const extraAction: IAction = {
91
+ title: 'Start',
92
+ variant: ButtonVariant.secondary,
93
+ onClick: (_event, rowId, rowData, extra) => console.log('clicked on extra action on row: ', rowId, rowData, extra),
94
+ isOutsideDropdown: true
95
+ };
96
+ const actions: IActions = [
97
+ {
98
+ title: 'Some action',
99
+ onClick: (_event, rowId, rowData, extra) => console.log('clicked on Some action, on row: ', rowId, rowData, extra)
100
+ },
101
+ {
102
+ title: <a href="#">Link action</a>
103
+ },
104
+ {
105
+ isSeparator: true
106
+ },
107
+ {
108
+ title: 'Third action',
109
+ onClick: (_event, rowId, rowData, extra) =>
110
+ console.log('clicked on Third action, on row: ', rowId, rowData, extra)
111
+ },
112
+ ...(useExtraAction ? [extraAction] : [])
113
+ ];
114
+
115
+ /**
116
+ * Use actions or actionResolver, not both
117
+ */
118
+ const actionResolver: IActionsResolver = (rowData, { rowIndex }) => {
119
+ if (rowIndex === 1) {
120
+ return [];
121
+ }
122
+
123
+ const extraAction: IActions = [
124
+ {
125
+ title: 'Start',
126
+ variant: ButtonVariant.secondary,
127
+ onClick: (_event, rowId, rowData, extra) =>
128
+ console.log('clicked on extra action on row: ', rowId, rowData, extra),
129
+ isOutsideDropdown: true
130
+ }
131
+ ];
132
+
133
+ const thirdAction: IActions = [
134
+ {
135
+ isSeparator: true
136
+ },
137
+ {
138
+ title: `${rowData.type} action`,
139
+ onClick: (_event, rowId, rowData, extra) =>
140
+ console.log(`clicked on ${rowData.type} action, on row ${rowId} of type ${rowData.type}`, extra)
141
+ }
142
+ ];
143
+
144
+ return [
145
+ ...(useExtraAction ? extraAction : []),
146
+ {
147
+ title: 'actionResolver action',
148
+ onClick: (_event, rowId, rowData, extra) =>
149
+ console.log(`clicked on Some action, on row ${rowId} of type ${rowData.type}`, extra)
150
+ },
151
+ {
152
+ title: <div>Another action</div>,
153
+ onClick: (_event, rowId, rowData, extra) =>
154
+ console.log(`clicked on Another action, on row ${rowId} of type ${rowData.type}`, extra)
155
+ },
156
+ ...(rowData.type ? thirdAction : [])
157
+ ];
158
+ };
159
+
160
+ return (
161
+ <React.Fragment>
162
+ <Toolbar>
163
+ <ToolbarContent>
164
+ <ToolbarItem>
165
+ <ToggleGroup aria-label="actions or actionResolver">
166
+ <ToggleGroupItem
167
+ text="Use actions prop"
168
+ buttonId="actions"
169
+ isSelected={propToUse === 'actions'}
170
+ onChange={onPropToUseChange}
171
+ />
172
+ <ToggleGroupItem
173
+ text="Use actionResolver prop"
174
+ buttonId="actionResolver"
175
+ isSelected={propToUse === 'actionResolver'}
176
+ onChange={onPropToUseChange}
177
+ />
178
+ </ToggleGroup>
179
+ </ToolbarItem>
180
+ <ToolbarItem>
181
+ <Checkbox
182
+ label="Use custom actions toggle"
183
+ isChecked={useCustomToggle}
184
+ onChange={setUseCustomToggle}
185
+ aria-label="toggle use of custom actions toggle"
186
+ id="toggle-custom-actions-toggle"
187
+ name="toggle-custom-actions-toggle"
188
+ />
189
+ </ToolbarItem>
190
+ <ToolbarItem>
191
+ <Checkbox
192
+ label="Add extra actions"
193
+ isChecked={useExtraAction}
194
+ onChange={setUseExtraAction}
195
+ aria-label="toggle extra actions"
196
+ id="toggle-extra-action"
197
+ name="toggle-extra-action"
198
+ />
199
+ </ToolbarItem>
200
+ </ToolbarContent>
201
+ </Toolbar>
202
+ <Table
203
+ aria-label="Actions table"
204
+ cells={columns}
205
+ rows={rows}
206
+ {...(propToUse === 'actions' && { actions })}
207
+ {...(propToUse === 'actionResolver' && { actionResolver })}
208
+ areActionsDisabled={rowData => !!rowData.disableActions}
209
+ dropdownPosition="left"
210
+ dropdownDirection="down"
211
+ actionsToggle={useCustomToggle ? customActionsToggle : undefined}
212
+ >
213
+ <TableHeader />
214
+ <TableBody />
215
+ </Table>
216
+ </React.Fragment>
217
+ );
218
+ };
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import { Table, TableHeader, TableBody, TableProps } from '@patternfly/react-table';
3
+ import { ToggleGroup, ToggleGroupItem, ToggleGroupItemProps } from '@patternfly/react-core';
4
+ interface Repository {
5
+ name: string;
6
+ branches: string;
7
+ prs: string;
8
+ workspaces: string;
9
+ lastCommit: string;
10
+ }
11
+
12
+ type ExampleType = 'default' | 'compact' | 'compactBorderless';
13
+
14
+ export const LegacyTableBasic: React.FunctionComponent = () => {
15
+ // In real usage, this data would come from some external source like an API via props.
16
+ const repositories: Repository[] = [
17
+ {
18
+ name: 'Repository one',
19
+ branches: 'Branch one',
20
+ prs: 'PR one',
21
+ workspaces: 'Workspace one',
22
+ lastCommit: 'Commit one'
23
+ },
24
+ {
25
+ name: 'Repository two',
26
+ branches: 'Branch two',
27
+ prs: 'PR two',
28
+ workspaces: 'Workspace two',
29
+ lastCommit: 'Commit two'
30
+ },
31
+ {
32
+ name: 'Repository three',
33
+ branches: 'Branch three',
34
+ prs: 'PR three',
35
+ workspaces: 'Workspace three',
36
+ lastCommit: 'Commit three'
37
+ }
38
+ ];
39
+
40
+ // This state is just for the ToggleGroup in this example and isn't necessary for TableComposable usage.
41
+ const [exampleChoice, setExampleChoice] = React.useState<ExampleType>('default');
42
+ const onExampleTypeChange: ToggleGroupItemProps['onChange'] = (_isSelected, event) => {
43
+ const id = event.currentTarget.id;
44
+ setExampleChoice(id as ExampleType);
45
+ };
46
+
47
+ const columns: TableProps['cells'] = ['Repositories', 'Branches', 'Pull requests', 'Workspaces', 'Last commit'];
48
+ const rows: TableProps['rows'] = repositories.map(repo => [
49
+ repo.name,
50
+ repo.branches,
51
+ repo.prs,
52
+ repo.workspaces,
53
+ repo.lastCommit
54
+ ]);
55
+
56
+ return (
57
+ <React.Fragment>
58
+ <ToggleGroup aria-label="Default with single selectable">
59
+ <ToggleGroupItem
60
+ text="Default"
61
+ buttonId="default"
62
+ isSelected={exampleChoice === 'default'}
63
+ onChange={onExampleTypeChange}
64
+ />
65
+ <ToggleGroupItem
66
+ text="Compact"
67
+ buttonId="compact"
68
+ isSelected={exampleChoice === 'compact'}
69
+ onChange={onExampleTypeChange}
70
+ />
71
+ <ToggleGroupItem
72
+ text="Compact borderless"
73
+ buttonId="compactBorderless"
74
+ isSelected={exampleChoice === 'compactBorderless'}
75
+ onChange={onExampleTypeChange}
76
+ />
77
+ </ToggleGroup>
78
+ <Table
79
+ aria-label="Simple Table"
80
+ variant={exampleChoice !== 'default' ? 'compact' : undefined}
81
+ borders={exampleChoice !== 'compactBorderless'}
82
+ cells={columns}
83
+ rows={rows}
84
+ >
85
+ <TableHeader />
86
+ <TableBody />
87
+ </Table>
88
+ </React.Fragment>
89
+ );
90
+ };
@@ -0,0 +1,66 @@
1
+ import React from 'react';
2
+ import { Table, TableHeader, TableBody, classNames, cellWidth, Visibility, TableProps } from '@patternfly/react-table';
3
+
4
+ interface Repository {
5
+ name: string;
6
+ branches: string;
7
+ prs: string;
8
+ workspaces: string;
9
+ lastCommit: string;
10
+ }
11
+
12
+ export const LegacyTableCellWidth: React.FunctionComponent = () => {
13
+ // In real usage, this data would come from some external source like an API via props.
14
+ const repositories: Repository[] = [
15
+ {
16
+ name: 'one - 1',
17
+ branches: 'two - 1 (visible only on md)',
18
+ prs: 'three - 1 (hidden only on md)',
19
+ workspaces: 'four - 1 (hidden on xs)',
20
+ lastCommit: 'five - 1'
21
+ },
22
+ {
23
+ name: 'one - 2',
24
+ branches: 'two - 2 (visible only on md)',
25
+ prs: 'three - 2 (hidden only on md)',
26
+ workspaces: 'four - 2 (hidden on xs)',
27
+ lastCommit: 'five - 2'
28
+ }
29
+ ];
30
+
31
+ const columns: TableProps['cells'] = [
32
+ { title: 'Header cell', transforms: [cellWidth(10)] },
33
+ {
34
+ title: 'Branches (visible only on md and 2Xl)',
35
+ columnTransforms: [
36
+ classNames(Visibility.hidden, Visibility.visibleOnMd, Visibility.hiddenOnLg, Visibility.visibleOn2Xl)
37
+ ]
38
+ },
39
+ {
40
+ title: 'Pull requests (hidden only on md)',
41
+ columnTransforms: [classNames(Visibility.hiddenOnMd, Visibility.visibleOnLg)]
42
+ },
43
+ {
44
+ title: 'Workspaces (hidden on xs)',
45
+ columnTransforms: [classNames(Visibility.hidden, Visibility.visibleOnSm)]
46
+ },
47
+ {
48
+ title: 'Last commit',
49
+ transforms: [cellWidth(30)]
50
+ }
51
+ ];
52
+ const rows: TableProps['rows'] = repositories.map(repo => [
53
+ repo.name,
54
+ repo.branches,
55
+ repo.prs,
56
+ repo.workspaces,
57
+ repo.lastCommit
58
+ ]);
59
+
60
+ return (
61
+ <Table aria-label="Table with width and breakpoint visibility modifiers" cells={columns} rows={rows}>
62
+ <TableHeader />
63
+ <TableBody />
64
+ </Table>
65
+ );
66
+ };