@deephaven/components 0.11.6-beta.5 → 0.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Button.d.ts CHANGED
@@ -14,6 +14,7 @@ interface BaseButtonProps extends React.ComponentPropsWithRef<'button'> {
14
14
  tooltip?: string | JSX.Element;
15
15
  icon?: IconDefinition | JSX.Element;
16
16
  active?: boolean;
17
+ 'data-testid'?: string;
17
18
  }
18
19
  declare type ButtonWithChildren = BaseButtonProps & {
19
20
  children: React.ReactNode;
@@ -23,6 +24,6 @@ declare type IconOnlyButton = BaseButtonProps & {
23
24
  icon: IconDefinition | JSX.Element;
24
25
  children?: undefined;
25
26
  };
26
- declare const Button: React.ForwardRefExoticComponent<(Pick<ButtonWithChildren, "className" | "dir" | "form" | "slot" | "style" | "title" | "children" | "tooltip" | "onClick" | "onKeyDown" | "onBlur" | "tabIndex" | "role" | "value" | "onChange" | "disabled" | "spellCheck" | "type" | "onFocus" | "placeholder" | "id" | "onMouseDown" | "onPaste" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "translate" | "radioGroup" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "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" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "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" | "kind" | "icon" | "variant" | "active"> | Pick<IconOnlyButton, "className" | "dir" | "form" | "slot" | "style" | "title" | "children" | "tooltip" | "onClick" | "onKeyDown" | "onBlur" | "tabIndex" | "role" | "value" | "onChange" | "disabled" | "spellCheck" | "type" | "onFocus" | "placeholder" | "id" | "onMouseDown" | "onPaste" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "translate" | "radioGroup" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "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" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "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" | "kind" | "icon" | "variant" | "active">) & React.RefAttributes<HTMLButtonElement>>;
27
+ declare const Button: React.ForwardRefExoticComponent<(Pick<ButtonWithChildren, "className" | "dir" | "form" | "slot" | "style" | "title" | "children" | "tooltip" | "onClick" | "onKeyDown" | "onBlur" | "tabIndex" | "role" | "value" | "onChange" | "disabled" | "spellCheck" | "type" | "onFocus" | "placeholder" | "id" | "onMouseDown" | "onPaste" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "translate" | "radioGroup" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "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" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "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" | "kind" | "icon" | "variant" | "active" | "data-testid"> | Pick<IconOnlyButton, "className" | "dir" | "form" | "slot" | "style" | "title" | "children" | "tooltip" | "onClick" | "onKeyDown" | "onBlur" | "tabIndex" | "role" | "value" | "onChange" | "disabled" | "spellCheck" | "type" | "onFocus" | "placeholder" | "id" | "onMouseDown" | "onPaste" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "lang" | "translate" | "radioGroup" | "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" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "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" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "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" | "kind" | "icon" | "variant" | "active" | "data-testid">) & React.RefAttributes<HTMLButtonElement>>;
27
28
  export default Button;
28
29
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,QAAA,MAAM,YAAY,uFAQR,CAAC;AACX,aAAK,WAAW,GAAG,OAAO,YAAY,CAAC;AACvC,aAAK,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;AAEtC,QAAA,MAAM,aAAa,wBAAyB,CAAC;AAC7C,aAAK,YAAY,GAAG,OAAO,aAAa,CAAC;AACzC,aAAK,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;AAExC,aAAK,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEjD,UAAU,eAAgB,SAAQ,KAAK,CAAC,qBAAqB,CAAC,QAAQ,CAAC;IACrE,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC/B,IAAI,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC;IACpC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,aAAK,kBAAkB,GAAG,eAAe,GAAG;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,aAAK,cAAc,GAAG,eAAe,GAAG;IACtC,OAAO,EAAE,MAAM,GA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,OAAO,CAAC;IAC9B,IAAI,EAAE,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC;IACnC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAiCF,QAAA,MAAM,MAAM,mhTA2EX,CAAC;AA6DF,eAAe,MAAM,CAAC"}
package/dist/Button.js CHANGED
@@ -53,7 +53,8 @@ var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
53
53
  onClick,
54
54
  className,
55
55
  style,
56
- children
56
+ children,
57
+ 'data-testid': dataTestId
57
58
  } = props;
58
59
  var iconOnly = icon && !children;
59
60
  var btnClassName = getClassName(kind, iconOnly);
@@ -78,6 +79,7 @@ var Button = /*#__PURE__*/React.forwardRef((props, ref) => {
78
79
  }
79
80
 
80
81
  var button = /*#__PURE__*/React.createElement("button", {
82
+ "data-testid": dataTestId,
81
83
  ref: ref // eslint-disable-next-line react/button-has-type
82
84
  ,
83
85
  type: type,
@@ -153,7 +155,8 @@ Button.propTypes = {
153
155
 
154
156
  children: PropTypes.node,
155
157
  className: PropTypes.string,
156
- style: PropTypes.object
158
+ style: PropTypes.object,
159
+ 'data-testid': PropTypes.string
157
160
  };
158
161
  Button.defaultProps = {
159
162
  type: 'button',
@@ -165,7 +168,8 @@ Button.defaultProps = {
165
168
  active: undefined,
166
169
  children: undefined,
167
170
  className: undefined,
168
- style: {}
171
+ style: {},
172
+ 'data-testid': undefined
169
173
  };
170
174
  export default Button;
171
175
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Button.tsx"],"names":["React","PropTypes","classNames","FontAwesomeIcon","Tooltip","BUTTON_KINDS","VARIANT_KINDS","getClassName","kind","iconOnly","getVariantClasses","Button","forwardRef","props","ref","variant","type","tooltip","icon","disabled","active","onClick","className","style","children","btnClassName","variantClassName","iconElem","isValidElement","tooltipElem","button","displayName","propTypes","oneOf","isRequired","Error","iconName","bool","undefined","node","string","object","defaultProps"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,O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c,KAAJ,CAAU,0CAAV,CAAP;AACD;;AACD,QAAId,OAAO,KAAKiB,SAAZ,IAAyB,OAAOjB,OAAP,KAAmB,UAAhD,EAA4D;AAC1D,aAAO,IAAIc,KAAJ,CAAU,4BAAV,CAAP;AACD;;AACD,WAAO,IAAP;AACD,GApCgB;;AAqCjBX,EAAAA,QAAQ,EAAEvB,SAAS,CAACsC,IArCH;AAsCjBjB,EAAAA,SAAS,EAAErB,SAAS,CAACuC,MAtCJ;AAuCjBjB,EAAAA,KAAK,EAAEtB,SAAS,CAACwC;AAvCA,CAAnB;AA0CA9B,MAAM,CAAC+B,YAAP,GAAsB;AACpB1B,EAAAA,IAAI,EAAE,QADc;AAEpBK,EAAAA,OAAO,EAAEiB,SAFW;AAGpBvB,EAAAA,OAAO,EAAEuB,SAHW;AAIpBrB,EAAAA,OAAO,EAAEqB,SAJW;AAKpBpB,EAAAA,IAAI,EAAEoB,SALc;AAMpBnB,EAAAA,QAAQ,EAAE,KANU;AAOpBC,EAAAA,MAAM,EAAEkB,SAPY;AAQpBd,EAAAA,QAAQ,EAAEc,SARU;AASpBhB,EAAAA,SAAS,EAAEgB,SATS;AAUpBf,EAAAA,KAAK,EAAE;AAVa,CAAtB;AAaA,eAAeZ,MAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { IconDefinition } from '@fortawesome/fontawesome-svg-core';\nimport { Tooltip } from './popper';\n\nconst BUTTON_KINDS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'success',\n 'danger',\n 'inline',\n 'ghost',\n] as const;\ntype ButtonTuple = typeof BUTTON_KINDS;\ntype ButtonKind = ButtonTuple[number];\n\nconst VARIANT_KINDS = ['group-end'] as const;\ntype VariantTuple = typeof VARIANT_KINDS;\ntype VariantKind = VariantTuple[number];\n\ntype ButtonTypes = 'submit' | 'reset' | 'button';\n\ninterface BaseButtonProps extends React.ComponentPropsWithRef<'button'> {\n kind: ButtonKind;\n type?: ButtonTypes;\n variant?: VariantKind;\n tooltip?: string | JSX.Element;\n icon?: IconDefinition | JSX.Element;\n active?: boolean;\n}\n\ntype ButtonWithChildren = BaseButtonProps & {\n children: React.ReactNode;\n};\n\ntype IconOnlyButton = BaseButtonProps & {\n tooltip: string | JSX.Element;\n icon: IconDefinition | JSX.Element;\n children?: undefined;\n};\n\ntype ButtonProps = IconOnlyButton | ButtonWithChildren;\n\nfunction getClassName(kind: ButtonKind, iconOnly: boolean): string {\n switch (kind) {\n case 'primary':\n return 'btn-primary';\n case 'secondary':\n return 'btn-outline-primary';\n case 'tertiary':\n return 'btn-secondary';\n case 'success':\n return 'btn-success';\n case 'danger':\n return 'btn-danger';\n case 'inline':\n return 'btn-inline';\n case 'ghost':\n return classNames('btn-link', {\n 'btn-link-icon': iconOnly,\n 'px-2': iconOnly,\n });\n }\n}\n\nfunction getVariantClasses(kind: VariantKind): string {\n switch (kind) {\n case 'group-end':\n return classNames('pl-2', 'pr-3');\n }\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props: ButtonProps, ref) => {\n const {\n kind,\n variant,\n type,\n tooltip,\n icon,\n disabled,\n active,\n onClick,\n className,\n style,\n children,\n } = props;\n\n const iconOnly = (icon && !children) as boolean;\n const btnClassName = getClassName(kind, iconOnly);\n\n let variantClassName;\n if (variant) {\n variantClassName = getVariantClasses(variant);\n }\n\n let iconElem: JSX.Element | undefined;\n if (icon) {\n iconElem = React.isValidElement(icon) ? (\n icon\n ) : (\n <FontAwesomeIcon icon={icon as IconDefinition} />\n );\n }\n\n let tooltipElem: JSX.Element | undefined;\n if (tooltip) {\n tooltipElem =\n typeof tooltip === 'string' ? <Tooltip>{tooltip}</Tooltip> : tooltip;\n }\n\n const button = (\n <button\n ref={ref}\n // eslint-disable-next-line react/button-has-type\n type={type}\n className={classNames(\n 'btn',\n btnClassName,\n variantClassName,\n { active },\n className\n )}\n onClick={onClick}\n style={style}\n disabled={disabled}\n >\n {icon && iconElem}\n {children}\n {tooltip && !disabled && tooltipElem}\n </button>\n );\n\n // disabled buttons tooltips need a wrapped element to receive pointer events\n // https://jakearchibald.com/2017/events-and-disabled-form-fields/\n\n return disabled ? (\n <span className=\"btn-disabled-wrapper\">\n {button}\n {tooltip && tooltipElem}\n </span>\n ) : (\n button\n );\n }\n);\n\nButton.displayName = 'Button';\n\nButton.propTypes = {\n kind: PropTypes.oneOf(BUTTON_KINDS).isRequired,\n variant: PropTypes.oneOf(VARIANT_KINDS),\n type: PropTypes.oneOf<ButtonTypes>(['submit', 'reset', 'button']),\n tooltip(props) {\n const { tooltip, icon, children } = props;\n if (!tooltip && icon && !children) {\n return new Error('Tooltip is required for icon only buttons');\n }\n return null;\n },\n icon(props) {\n const { children, icon } = props;\n if (!icon && !children) {\n return new Error('Icon is required if no children are provided');\n }\n\n if (!children && !React.isValidElement(icon) && !icon?.iconName) {\n return new Error(\n 'Icon must be react element or fontawesome IconDefinition'\n );\n }\n\n return null;\n },\n disabled: PropTypes.bool,\n active: PropTypes.bool,\n onClick(props) {\n const { onClick, type } = props;\n if (type === 'button' && typeof onClick !== 'function') {\n return new Error('type button requires an onClick function');\n }\n if (onClick !== undefined && typeof onClick !== 'function') {\n return new Error('onClick must be a function');\n }\n return null;\n },\n children: PropTypes.node,\n className: PropTypes.string,\n style: PropTypes.object,\n};\n\nButton.defaultProps = {\n type: 'button',\n onClick: undefined,\n variant: undefined,\n tooltip: undefined,\n icon: undefined,\n disabled: false,\n active: undefined,\n children: undefined,\n className: undefined,\n style: {},\n};\n\nexport default Button;\n"],"file":"Button.js"}
1
+ {"version":3,"sources":["../src/Button.tsx"],"names":["React","PropTypes","classNames","FontAwesomeIcon","Tooltip","BUTTON_KINDS","VARIANT_KINDS","getClassName","kind","iconOnly","getVariantClasses","Button","forwardRef","props","ref","variant","type","tooltip","icon","disabled","active","onClick","className","style","children","dataTestId","btnClassName","variantClassName","iconElem","isValidElement","tooltipElem","button","displayName","propTypes","oneOf","isRequired","Error","iconName","bool","undefined","node","string","object","defaultProps"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,eAAT,QAAgC,gCAAhC;SAESC,O;AAET,IAAMC,YAAY,GAAG,CACnB,SADmB,EAEnB,WAFmB,EAGnB,UAHmB,EAInB,SAJmB,EAKnB,QALmB,EAMnB,QANmB,EAOnB,OAPmB,CAArB;AAYA,IAAMC,aAAa,GAAG,CAAC,WAAD,CAAtB;;AA4BA,SAASC,YAAT,CAAsBC,IAAtB,EAAwCC,QAAxC,EAAmE;AACjE,UAAQD,IAAR;AACE,SAAK,SAAL;AACE,aAAO,aAAP;;AACF,SAAK,WAAL;AACE,aAAO,qBAAP;;AACF,SAAK,UAAL;AACE,aAAO,eAAP;;AACF,SAAK,SAAL;AACE,aAAO,aAAP;;AACF,SAAK,QAAL;AACE,aAAO,YAAP;;AACF,SAAK,QAAL;AACE,aAAO,YAAP;;AACF,SAAK,OAAL;AACE,aAAON,UAAU,CAAC,UAAD,EAAa;AAC5B,yBAAiBO,QADW;AAE5B,gBAAQA;AAFoB,OAAb,CAAjB;AAdJ;AAmBD;;AAED,SAASC,iBAAT,CAA2BF,IAA3B,EAAsD;AACpD,UAAQA,IAAR;AACE,SAAK,WAAL;AACE,aAAON,UAAU,CAAC,MAAD,EAAS,MAAT,CAAjB;AAFJ;AAID;;AAED,IAAMS,MAAM,gBAAGX,KAAK,CAACY,UAAN,CACb,CAACC,KAAD,EAAqBC,GAArB,KAA6B;AAC3B,MAAM;AACJN,IAAAA,IADI;AAEJO,IAAAA,OAFI;AAGJC,IAAAA,IAHI;AAIJC,IAAAA,OAJI;AAKJC,IAAAA,IALI;AAMJC,IAAAA,QANI;AAOJC,IAAAA,MAPI;AAQJC,IAAAA,OARI;AASJC,IAAAA,SATI;AAUJC,IAAAA,KAVI;AAWJC,IAAAA,QAXI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F;AAAWL,MAAAA;AAAX,QAAoBH,KAA1B;;AACA,QAAIG,IAAI,KAAK,QAAT,IAAqB,OAAOK,OAAP,KAAmB,UAA5C,EAAwD;AACtD,aAAO,IAAIe,KAAJ,CAAU,0CAAV,CAAP;AACD;;AACD,QAAIf,OAAO,KAAKkB,SAAZ,IAAyB,OAAOlB,OAAP,KAAmB,UAAhD,EAA4D;AAC1D,aAAO,IAAIe,KAAJ,CAAU,4BAAV,CAAP;AACD;;AACD,WAAO,IAAP;AACD,GApCgB;;AAqCjBZ,EAAAA,QAAQ,EAAEvB,SAAS,CAACuC,IArCH;AAsCjBlB,EAAAA,SAAS,EAAErB,SAAS,CAACwC,MAtCJ;AAuCjBlB,EAAAA,KAAK,EAAEtB,SAAS,CAACyC,MAvCA;AAwCjB,iBAAezC,SAAS,CAACwC;AAxCR,CAAnB;AA2CA9B,MAAM,CAACgC,YAAP,GAAsB;AACpB3B,EAAAA,IAAI,EAAE,QADc;AAEpBK,EAAAA,OAAO,EAAEkB,SAFW;AAGpBxB,EAAAA,OAAO,EAAEwB,SAHW;AAIpBtB,EAAAA,OAAO,EAAEsB,SAJW;AAKpBrB,EAAAA,IAAI,EAAEqB,SALc;AAMpBpB,EAAAA,QAAQ,EAAE,KANU;AAOpBC,EAAAA,MAAM,EAAEmB,SAPY;AAQpBf,EAAAA,QAAQ,EAAEe,SARU;AASpBjB,EAAAA,SAAS,EAAEiB,SATS;AAUpBhB,EAAAA,KAAK,EAAE,EAVa;AAWpB,iBAAegB;AAXK,CAAtB;AAcA,eAAe5B,MAAf","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { IconDefinition } from '@fortawesome/fontawesome-svg-core';\nimport { Tooltip } from './popper';\n\nconst BUTTON_KINDS = [\n 'primary',\n 'secondary',\n 'tertiary',\n 'success',\n 'danger',\n 'inline',\n 'ghost',\n] as const;\ntype ButtonTuple = typeof BUTTON_KINDS;\ntype ButtonKind = ButtonTuple[number];\n\nconst VARIANT_KINDS = ['group-end'] as const;\ntype VariantTuple = typeof VARIANT_KINDS;\ntype VariantKind = VariantTuple[number];\n\ntype ButtonTypes = 'submit' | 'reset' | 'button';\n\ninterface BaseButtonProps extends React.ComponentPropsWithRef<'button'> {\n kind: ButtonKind;\n type?: ButtonTypes;\n variant?: VariantKind;\n tooltip?: string | JSX.Element;\n icon?: IconDefinition | JSX.Element;\n active?: boolean;\n 'data-testid'?: string;\n}\n\ntype ButtonWithChildren = BaseButtonProps & {\n children: React.ReactNode;\n};\n\ntype IconOnlyButton = BaseButtonProps & {\n tooltip: string | JSX.Element;\n icon: IconDefinition | JSX.Element;\n children?: undefined;\n};\n\ntype ButtonProps = IconOnlyButton | ButtonWithChildren;\n\nfunction getClassName(kind: ButtonKind, iconOnly: boolean): string {\n switch (kind) {\n case 'primary':\n return 'btn-primary';\n case 'secondary':\n return 'btn-outline-primary';\n case 'tertiary':\n return 'btn-secondary';\n case 'success':\n return 'btn-success';\n case 'danger':\n return 'btn-danger';\n case 'inline':\n return 'btn-inline';\n case 'ghost':\n return classNames('btn-link', {\n 'btn-link-icon': iconOnly,\n 'px-2': iconOnly,\n });\n }\n}\n\nfunction getVariantClasses(kind: VariantKind): string {\n switch (kind) {\n case 'group-end':\n return classNames('pl-2', 'pr-3');\n }\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (props: ButtonProps, ref) => {\n const {\n kind,\n variant,\n type,\n tooltip,\n icon,\n disabled,\n active,\n onClick,\n className,\n style,\n children,\n 'data-testid': dataTestId,\n } = props;\n\n const iconOnly = (icon && !children) as boolean;\n const btnClassName = getClassName(kind, iconOnly);\n\n let variantClassName;\n if (variant) {\n variantClassName = getVariantClasses(variant);\n }\n\n let iconElem: JSX.Element | undefined;\n if (icon) {\n iconElem = React.isValidElement(icon) ? (\n icon\n ) : (\n <FontAwesomeIcon icon={icon as IconDefinition} />\n );\n }\n\n let tooltipElem: JSX.Element | undefined;\n if (tooltip) {\n tooltipElem =\n typeof tooltip === 'string' ? <Tooltip>{tooltip}</Tooltip> : tooltip;\n }\n\n const button = (\n <button\n data-testid={dataTestId}\n ref={ref}\n // eslint-disable-next-line react/button-has-type\n type={type}\n className={classNames(\n 'btn',\n btnClassName,\n variantClassName,\n { active },\n className\n )}\n onClick={onClick}\n style={style}\n disabled={disabled}\n >\n {icon && iconElem}\n {children}\n {tooltip && !disabled && tooltipElem}\n </button>\n );\n\n // disabled buttons tooltips need a wrapped element to receive pointer events\n // https://jakearchibald.com/2017/events-and-disabled-form-fields/\n\n return disabled ? (\n <span className=\"btn-disabled-wrapper\">\n {button}\n {tooltip && tooltipElem}\n </span>\n ) : (\n button\n );\n }\n);\n\nButton.displayName = 'Button';\n\nButton.propTypes = {\n kind: PropTypes.oneOf(BUTTON_KINDS).isRequired,\n variant: PropTypes.oneOf(VARIANT_KINDS),\n type: PropTypes.oneOf<ButtonTypes>(['submit', 'reset', 'button']),\n tooltip(props) {\n const { tooltip, icon, children } = props;\n if (!tooltip && icon && !children) {\n return new Error('Tooltip is required for icon only buttons');\n }\n return null;\n },\n icon(props) {\n const { children, icon } = props;\n if (!icon && !children) {\n return new Error('Icon is required if no children are provided');\n }\n\n if (!children && !React.isValidElement(icon) && !icon?.iconName) {\n return new Error(\n 'Icon must be react element or fontawesome IconDefinition'\n );\n }\n\n return null;\n },\n disabled: PropTypes.bool,\n active: PropTypes.bool,\n onClick(props) {\n const { onClick, type } = props;\n if (type === 'button' && typeof onClick !== 'function') {\n return new Error('type button requires an onClick function');\n }\n if (onClick !== undefined && typeof onClick !== 'function') {\n return new Error('onClick must be a function');\n }\n return null;\n },\n children: PropTypes.node,\n className: PropTypes.string,\n style: PropTypes.object,\n 'data-testid': PropTypes.string,\n};\n\nButton.defaultProps = {\n type: 'button',\n onClick: undefined,\n variant: undefined,\n tooltip: undefined,\n icon: undefined,\n disabled: false,\n active: undefined,\n children: undefined,\n className: undefined,\n style: {},\n 'data-testid': undefined,\n};\n\nexport default Button;\n"],"file":"Button.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/components",
3
- "version": "0.11.6-beta.5+b4f6274",
3
+ "version": "0.11.6",
4
4
  "description": "Deephaven React component library",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -30,9 +30,9 @@
30
30
  "start": "cross-env NODE_ENV=development npm run watch"
31
31
  },
32
32
  "dependencies": {
33
- "@deephaven/icons": "^0.11.6-beta.5+b4f6274",
34
- "@deephaven/react-hooks": "^0.11.6-beta.5+b4f6274",
35
- "@deephaven/utils": "^0.11.6-beta.5+b4f6274",
33
+ "@deephaven/icons": "^0.11.6",
34
+ "@deephaven/react-hooks": "^0.11.4",
35
+ "@deephaven/utils": "^0.11.4",
36
36
  "@fortawesome/fontawesome-svg-core": "1.2.36",
37
37
  "@fortawesome/react-fontawesome": "^0.1.15",
38
38
  "bootstrap": "4.6.1",
@@ -57,9 +57,9 @@
57
57
  "react-dom": "^17.x"
58
58
  },
59
59
  "devDependencies": {
60
- "@deephaven/log": "^0.11.6-beta.5+b4f6274",
61
- "@deephaven/mocks": "^0.11.6-beta.5+b4f6274",
62
- "@deephaven/tsconfig": "^0.11.6-beta.5+b4f6274"
60
+ "@deephaven/log": "^0.11.4",
61
+ "@deephaven/mocks": "^0.11.3",
62
+ "@deephaven/tsconfig": "^0.11.3"
63
63
  },
64
64
  "files": [
65
65
  "dist",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "b4f6274363e05fc70a920716faa1ff5171508c70"
74
+ "gitHead": "35c0d6cf3f250fcb706083f1279827833c38492c"
75
75
  }