@deephaven/components 0.73.1-beta.0 → 0.74.1-beta.1

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 (46) hide show
  1. package/dist/Button.d.ts +1 -1
  2. package/dist/HierarchicalCheckboxMenu.js +1 -1
  3. package/dist/HierarchicalCheckboxMenu.js.map +1 -1
  4. package/dist/Select.d.ts +1 -1
  5. package/dist/spectrum/ItemContent.d.ts.map +1 -1
  6. package/dist/spectrum/ItemContent.js +2 -1
  7. package/dist/spectrum/ItemContent.js.map +1 -1
  8. package/dist/spectrum/picker/Picker.d.ts +6 -8
  9. package/dist/spectrum/picker/Picker.d.ts.map +1 -1
  10. package/dist/spectrum/picker/Picker.js +54 -59
  11. package/dist/spectrum/picker/Picker.js.map +1 -1
  12. package/dist/spectrum/picker/PickerNormalized.d.ts +16 -0
  13. package/dist/spectrum/picker/PickerNormalized.d.ts.map +1 -0
  14. package/dist/spectrum/picker/PickerNormalized.js +88 -0
  15. package/dist/spectrum/picker/PickerNormalized.js.map +1 -0
  16. package/dist/spectrum/picker/index.d.ts +2 -0
  17. package/dist/spectrum/picker/index.d.ts.map +1 -1
  18. package/dist/spectrum/picker/index.js +2 -0
  19. package/dist/spectrum/picker/index.js.map +1 -1
  20. package/dist/spectrum/picker/usePickerScrollOnOpen.d.ts +22 -0
  21. package/dist/spectrum/picker/usePickerScrollOnOpen.d.ts.map +1 -0
  22. package/dist/spectrum/picker/usePickerScrollOnOpen.js +33 -0
  23. package/dist/spectrum/picker/usePickerScrollOnOpen.js.map +1 -0
  24. package/dist/spectrum/utils/index.d.ts +2 -0
  25. package/dist/spectrum/utils/index.d.ts.map +1 -1
  26. package/dist/spectrum/utils/index.js +2 -0
  27. package/dist/spectrum/utils/index.js.map +1 -1
  28. package/dist/spectrum/utils/itemUtils.d.ts +29 -3
  29. package/dist/spectrum/utils/itemUtils.d.ts.map +1 -1
  30. package/dist/spectrum/utils/itemUtils.js +69 -3
  31. package/dist/spectrum/utils/itemUtils.js.map +1 -1
  32. package/dist/spectrum/utils/itemWrapperUtils.d.ts +12 -0
  33. package/dist/spectrum/utils/itemWrapperUtils.d.ts.map +1 -0
  34. package/dist/spectrum/utils/itemWrapperUtils.js +65 -0
  35. package/dist/spectrum/utils/itemWrapperUtils.js.map +1 -0
  36. package/dist/spectrum/utils/useRenderNormalizedItem.d.ts.map +1 -1
  37. package/dist/spectrum/utils/useRenderNormalizedItem.js +3 -3
  38. package/dist/spectrum/utils/useRenderNormalizedItem.js.map +1 -1
  39. package/dist/spectrum/utils/useStringifiedMultiSelection.d.ts.map +1 -1
  40. package/dist/spectrum/utils/useStringifiedMultiSelection.js +5 -2
  41. package/dist/spectrum/utils/useStringifiedMultiSelection.js.map +1 -1
  42. package/dist/spectrum/utils/useStringifiedSelection.d.ts +33 -0
  43. package/dist/spectrum/utils/useStringifiedSelection.d.ts.map +1 -0
  44. package/dist/spectrum/utils/useStringifiedSelection.js +50 -0
  45. package/dist/spectrum/utils/useStringifiedSelection.js.map +1 -0
  46. package/package.json +7 -7
package/dist/Button.d.ts CHANGED
@@ -30,6 +30,6 @@ type IconOnlyButtonJsxTooltip = BaseButtonProps & {
30
30
  icon: IconDefinition | JSX.Element;
31
31
  children?: undefined;
32
32
  };
33
- declare const Button: React.ForwardRefExoticComponent<(Pick<ButtonWithChildren, "className" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "form" | "slot" | "style" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "children" | "id" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "tooltip" | "onClick" | "tabIndex" | "role" | "aria-label" | "icon" | "active" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "onKeyUp" | "lang" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind"> | Pick<IconOnlyButtonStringTooltip, "className" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "form" | "slot" | "style" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "children" | "id" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "tooltip" | "onClick" | "tabIndex" | "role" | "aria-label" | "icon" | "active" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "onKeyUp" | "lang" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind"> | Pick<IconOnlyButtonJsxTooltip, "className" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "form" | "slot" | "style" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "children" | "id" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "tooltip" | "onClick" | "tabIndex" | "role" | "aria-label" | "icon" | "active" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "onKeyUp" | "lang" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind">) & React.RefAttributes<HTMLButtonElement>>;
33
+ declare const Button: React.ForwardRefExoticComponent<(Pick<ButtonWithChildren, "className" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "form" | "slot" | "style" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "children" | "id" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "tooltip" | "onClick" | "tabIndex" | "role" | "icon" | "active" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "onKeyUp" | "lang" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind"> | Pick<IconOnlyButtonStringTooltip, "className" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "form" | "slot" | "style" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "children" | "id" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "tooltip" | "onClick" | "tabIndex" | "role" | "icon" | "active" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "onKeyUp" | "lang" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind"> | Pick<IconOnlyButtonJsxTooltip, "className" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "form" | "slot" | "style" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "children" | "id" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "tooltip" | "onClick" | "tabIndex" | "role" | "icon" | "active" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "onKeyUp" | "lang" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "variant" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind">) & React.RefAttributes<HTMLButtonElement>>;
34
34
  export default Button;
35
35
  //# sourceMappingURL=Button.d.ts.map
@@ -88,7 +88,7 @@ class HierarchicalCheckboxMenu extends Component {
88
88
  if (children instanceof Map) {
89
89
  var newChildren = new Map(children);
90
90
  if (child != null) {
91
- newChildren.set(child, children.get(child) === undefined);
91
+ newChildren.set(child, children.get(child) !== true);
92
92
  } else {
93
93
  var parentSelected = HierarchicalCheckboxMenu.isParentSelected(parent, map);
94
94
  var newChildValue = parentSelected == null || !parentSelected;
@@ -1 +1 @@
1
- {"version":3,"file":"HierarchicalCheckboxMenu.js","names":["React","Component","FontAwesomeIcon","classNames","Checkbox","Popper","Button","jsx","_jsx","jsxs","_jsxs","HierarchicalCheckboxMenu","isParentSelected","parent","valueMap","children","get","undefined","includesTrue","Array","from","values","includes","includesFalse","constructor","props","toggleMenu","bind","toggleValueFor","selectAll","clear","state","menuIsOpen","event","stopPropagation","preventDefault","setState","child","onUpdateValueMap","map","Map","newChildren","set","parentSelected","newChildValue","forEach","_","key","currentChildren","setAllValues","value","copy","renderMenuElement","dataTestId","className","entries","_ref","checked","onChange","_ref2","kind","onClick","concat","render","menuText","icon","id","type","options","placement","isShown","onExited","closeOnBlur","interactive","_defineProperty"],"sources":["../src/HierarchicalCheckboxMenu.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { IconDefinition } from '@deephaven/icons';\nimport classNames from 'classnames';\nimport Checkbox from './Checkbox';\nimport Popper from './popper/Popper';\nimport './HierarchicalCheckboxMenu.scss';\nimport Button from './Button';\n\nexport type HierarchicalCheckboxValueMap = Map<\n string,\n boolean | Map<string, boolean>\n>;\n\ntype HierarchicalCheckboxMenuProps = {\n className: string;\n menuText: string;\n valueMap: HierarchicalCheckboxValueMap;\n onUpdateValueMap: (map: HierarchicalCheckboxValueMap) => void;\n icon: IconDefinition | null;\n id: string;\n 'data-testid'?: string;\n};\n\ntype HierarchicalCheckboxMenuState = {\n menuIsOpen: boolean;\n};\n\n/**\n * A pull down menu that displays a hierarchy of checkboxes.\n *\n * Currently supports only two levels of check boxes. The input should be a Map\n * where the keys are the parent names. The values can a boolean if the parent\n * has no children or another Map where keys are child names and values are booleans.\n *\n * Here is an example:\n * const INITIAL_TYPE_MAP = new Map([\n * ['Queries', new Map([['Live', true], ['Batch', true]])],\n * [\n * 'DBA Queries',\n * new Map([\n * ['Data Merge', true],\n * ['Data Validation', true],\n * ['Imports', true],\n * ['Data Services', true],\n * ]),\n * ],\n * ['Helper Queries', true],\n * ]);\n *\n * When a checkbox is changed, this component will make a deep copy of the Map\n * with the appropriate booleans changed. It will then call onUpdateValueMap\n * with the new Map.\n */\nclass HierarchicalCheckboxMenu extends Component<\n HierarchicalCheckboxMenuProps,\n HierarchicalCheckboxMenuState\n> {\n static defaultProps: Partial<HierarchicalCheckboxMenuProps> = {\n className: '',\n icon: null,\n id: '',\n 'data-testid': undefined,\n };\n\n static isParentSelected(\n parent: string,\n valueMap: HierarchicalCheckboxValueMap\n ): boolean | null {\n const children = valueMap.get(parent);\n if (children === undefined) {\n return false;\n }\n if (typeof children === 'boolean') {\n // This parent has no children\n return children;\n }\n const includesTrue = Array.from(children.values()).includes(true);\n const includesFalse = Array.from(children.values()).includes(false);\n if (includesTrue && includesFalse) {\n // Indeterminate\n return null;\n }\n return includesTrue;\n }\n\n constructor(props: HierarchicalCheckboxMenuProps) {\n super(props);\n\n this.toggleMenu = this.toggleMenu.bind(this);\n this.toggleValueFor = this.toggleValueFor.bind(this);\n this.selectAll = this.selectAll.bind(this);\n this.clear = this.clear.bind(this);\n\n this.state = {\n menuIsOpen: false,\n };\n }\n\n toggleMenu(event: React.MouseEvent<HTMLButtonElement>): void {\n event.stopPropagation();\n event.preventDefault();\n this.setState(state => {\n const { menuIsOpen } = state;\n return { menuIsOpen: !menuIsOpen };\n });\n }\n\n toggleValueFor(parent: string, child?: string): void {\n const { valueMap, onUpdateValueMap } = this.props;\n\n // Make a deep copy of the Map and toggle the boolean for parent / child\n const map = new Map(valueMap);\n const children = map.get(parent);\n if (children instanceof Map) {\n const newChildren = new Map(children);\n if (child != null) {\n newChildren.set(child, children.get(child) === undefined);\n } else {\n const parentSelected = HierarchicalCheckboxMenu.isParentSelected(\n parent,\n map\n );\n const newChildValue = parentSelected == null || !parentSelected;\n children.forEach((_, key) => newChildren.set(key, newChildValue));\n }\n map.set(parent, newChildren);\n } else {\n map.set(parent, children == null || !children);\n }\n\n // The parent was clicked so all children must be toggled\n const currentChildren = map.get(parent);\n if (\n child === undefined &&\n currentChildren !== undefined &&\n typeof currentChildren !== 'boolean'\n ) {\n const parentSelected = HierarchicalCheckboxMenu.isParentSelected(\n parent,\n valueMap\n );\n if (parentSelected != null && parentSelected) {\n currentChildren.forEach((_, key) => currentChildren.set(key, false));\n } else {\n // for parent selection of false or null (indeterminate), select everything\n currentChildren.forEach((_, key) => currentChildren.set(key, true));\n }\n }\n\n onUpdateValueMap(map);\n }\n\n setAllValues(value: boolean): void {\n const { valueMap, onUpdateValueMap } = this.props;\n\n // Make a deep copy of the Map and set everything\n const copy = new Map();\n valueMap.forEach((child, parent) => {\n if (typeof child === 'boolean') {\n copy.set(parent, value);\n } else {\n const children = new Map();\n child.forEach((_, key) => children.set(key, value));\n copy.set(parent, children);\n }\n });\n\n onUpdateValueMap(copy);\n }\n\n selectAll(): void {\n this.setAllValues(true);\n }\n\n clear(): void {\n this.setAllValues(false);\n }\n\n renderMenuElement(): React.ReactNode {\n const { valueMap, 'data-testid': dataTestId } = this.props;\n return (\n <div className=\"hcm-menu-container\">\n {Array.from(valueMap.entries()).map(([parent, children]) => (\n <div key={parent}>\n <Checkbox\n className=\"hcm-parent\"\n checked={HierarchicalCheckboxMenu.isParentSelected(\n parent,\n valueMap\n )}\n onChange={() => this.toggleValueFor(parent)}\n >\n {parent}\n </Checkbox>\n {children !== undefined &&\n typeof children !== 'boolean' &&\n Array.from(children.entries()).map(([child, value]) => (\n <Checkbox\n className=\"hcm-child\"\n key={child}\n checked={value}\n onChange={() => this.toggleValueFor(parent, child)}\n >\n {child}\n </Checkbox>\n ))}\n </div>\n ))}\n <Button\n kind=\"ghost\"\n onClick={this.selectAll}\n data-testid={\n dataTestId !== undefined\n ? `${dataTestId}-btn-select-all`\n : undefined\n }\n >\n Select All\n </Button>\n <Button\n kind=\"ghost\"\n onClick={this.clear}\n data-testid={\n dataTestId !== undefined ? `${dataTestId}-btn-clear` : undefined\n }\n >\n Clear\n </Button>\n </div>\n );\n }\n\n render(): JSX.Element {\n const {\n menuText,\n className,\n icon,\n id,\n 'data-testid': dataTestId,\n } = this.props;\n const { menuIsOpen } = this.state;\n\n return (\n <button\n type=\"button\"\n className={classNames('btn hcm-btn', className)}\n onClick={this.toggleMenu}\n id={id}\n data-testid={dataTestId}\n >\n <span>\n {icon && <FontAwesomeIcon icon={icon} className=\"hcm-icon mr-1\" />}\n {menuText}\n </span>\n <span className=\"cs-caret\" />\n <Popper\n options={{ placement: 'bottom' }}\n isShown={menuIsOpen}\n onExited={() => {\n this.setState({ menuIsOpen: false });\n }}\n closeOnBlur\n interactive\n >\n {this.renderMenuElement()}\n </Popper>\n </button>\n );\n }\n}\n\nexport default HierarchicalCheckboxMenu;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,eAAe,Q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QAAM8C,SAAS,EAAC;MAAU,CAAE,CAAC,eAC7B9C,IAAA,CAACH,MAAM;QACL+D,OAAO,EAAE;UAAEC,SAAS,EAAE;QAAS,CAAE;QACjCC,OAAO,EAAEtC,UAAW;QACpBuC,QAAQ,EAAEA,CAAA,KAAM;UACd,IAAI,CAACnC,QAAQ,CAAC;YAAEJ,UAAU,EAAE;UAAM,CAAC,CAAC;QACtC,CAAE;QACFwC,WAAW;QACXC,WAAW;QAAA1D,QAAA,EAEV,IAAI,CAACqC,iBAAiB,CAAC;MAAC,CACnB,CAAC;IAAA,CACH,CAAC;EAEb;AACF;AAACsB,eAAA,CAxNK/D,wBAAwB,kBAIkC;EAC5D2C,SAAS,EAAE,EAAE;EACbW,IAAI,EAAE,IAAI;EACVC,EAAE,EAAE,EAAE;EACN,aAAa,EAAEjD;AACjB,CAAC;AAiNH,eAAeN,wBAAwB"}
1
+ {"version":3,"file":"HierarchicalCheckboxMenu.js","names":["React","Component","FontAwesomeIcon","classNames","Checkbox","Popper","Button","jsx","_jsx","jsxs","_jsxs","HierarchicalCheckboxMenu","isParentSelected","parent","valueMap","children","get","undefined","includesTrue","Array","from","values","includes","includesFalse","constructor","props","toggleMenu","bind","toggleValueFor","selectAll","clear","state","menuIsOpen","event","stopPropagation","preventDefault","setState","child","onUpdateValueMap","map","Map","newChildren","set","parentSelected","newChildValue","forEach","_","key","currentChildren","setAllValues","value","copy","renderMenuElement","dataTestId","className","entries","_ref","checked","onChange","_ref2","kind","onClick","concat","render","menuText","icon","id","type","options","placement","isShown","onExited","closeOnBlur","interactive","_defineProperty"],"sources":["../src/HierarchicalCheckboxMenu.tsx"],"sourcesContent":["import React, { Component } from 'react';\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome';\nimport { IconDefinition } from '@deephaven/icons';\nimport classNames from 'classnames';\nimport Checkbox from './Checkbox';\nimport Popper from './popper/Popper';\nimport './HierarchicalCheckboxMenu.scss';\nimport Button from './Button';\n\nexport type HierarchicalCheckboxValueMap = Map<\n string,\n boolean | Map<string, boolean>\n>;\n\ntype HierarchicalCheckboxMenuProps = {\n className: string;\n menuText: string;\n valueMap: HierarchicalCheckboxValueMap;\n onUpdateValueMap: (map: HierarchicalCheckboxValueMap) => void;\n icon: IconDefinition | null;\n id: string;\n 'data-testid'?: string;\n};\n\ntype HierarchicalCheckboxMenuState = {\n menuIsOpen: boolean;\n};\n\n/**\n * A pull down menu that displays a hierarchy of checkboxes.\n *\n * Currently supports only two levels of check boxes. The input should be a Map\n * where the keys are the parent names. The values can a boolean if the parent\n * has no children or another Map where keys are child names and values are booleans.\n *\n * Here is an example:\n * const INITIAL_TYPE_MAP = new Map([\n * ['Queries', new Map([['Live', true], ['Batch', true]])],\n * [\n * 'DBA Queries',\n * new Map([\n * ['Data Merge', true],\n * ['Data Validation', true],\n * ['Imports', true],\n * ['Data Services', true],\n * ]),\n * ],\n * ['Helper Queries', true],\n * ]);\n *\n * When a checkbox is changed, this component will make a deep copy of the Map\n * with the appropriate booleans changed. It will then call onUpdateValueMap\n * with the new Map.\n */\nclass HierarchicalCheckboxMenu extends Component<\n HierarchicalCheckboxMenuProps,\n HierarchicalCheckboxMenuState\n> {\n static defaultProps: Partial<HierarchicalCheckboxMenuProps> = {\n className: '',\n icon: null,\n id: '',\n 'data-testid': undefined,\n };\n\n static isParentSelected(\n parent: string,\n valueMap: HierarchicalCheckboxValueMap\n ): boolean | null {\n const children = valueMap.get(parent);\n if (children === undefined) {\n return false;\n }\n if (typeof children === 'boolean') {\n // This parent has no children\n return children;\n }\n const includesTrue = Array.from(children.values()).includes(true);\n const includesFalse = Array.from(children.values()).includes(false);\n if (includesTrue && includesFalse) {\n // Indeterminate\n return null;\n }\n return includesTrue;\n }\n\n constructor(props: HierarchicalCheckboxMenuProps) {\n super(props);\n\n this.toggleMenu = this.toggleMenu.bind(this);\n this.toggleValueFor = this.toggleValueFor.bind(this);\n this.selectAll = this.selectAll.bind(this);\n this.clear = this.clear.bind(this);\n\n this.state = {\n menuIsOpen: false,\n };\n }\n\n toggleMenu(event: React.MouseEvent<HTMLButtonElement>): void {\n event.stopPropagation();\n event.preventDefault();\n this.setState(state => {\n const { menuIsOpen } = state;\n return { menuIsOpen: !menuIsOpen };\n });\n }\n\n toggleValueFor(parent: string, child?: string): void {\n const { valueMap, onUpdateValueMap } = this.props;\n\n // Make a deep copy of the Map and toggle the boolean for parent / child\n const map = new Map(valueMap);\n const children = map.get(parent);\n if (children instanceof Map) {\n const newChildren = new Map(children);\n if (child != null) {\n newChildren.set(child, children.get(child) !== true);\n } else {\n const parentSelected = HierarchicalCheckboxMenu.isParentSelected(\n parent,\n map\n );\n const newChildValue = parentSelected == null || !parentSelected;\n children.forEach((_, key) => newChildren.set(key, newChildValue));\n }\n map.set(parent, newChildren);\n } else {\n map.set(parent, children == null || !children);\n }\n\n // The parent was clicked so all children must be toggled\n const currentChildren = map.get(parent);\n if (\n child === undefined &&\n currentChildren !== undefined &&\n typeof currentChildren !== 'boolean'\n ) {\n const parentSelected = HierarchicalCheckboxMenu.isParentSelected(\n parent,\n valueMap\n );\n if (parentSelected != null && parentSelected) {\n currentChildren.forEach((_, key) => currentChildren.set(key, false));\n } else {\n // for parent selection of false or null (indeterminate), select everything\n currentChildren.forEach((_, key) => currentChildren.set(key, true));\n }\n }\n\n onUpdateValueMap(map);\n }\n\n setAllValues(value: boolean): void {\n const { valueMap, onUpdateValueMap } = this.props;\n\n // Make a deep copy of the Map and set everything\n const copy = new Map();\n valueMap.forEach((child, parent) => {\n if (typeof child === 'boolean') {\n copy.set(parent, value);\n } else {\n const children = new Map();\n child.forEach((_, key) => children.set(key, value));\n copy.set(parent, children);\n }\n });\n\n onUpdateValueMap(copy);\n }\n\n selectAll(): void {\n this.setAllValues(true);\n }\n\n clear(): void {\n this.setAllValues(false);\n }\n\n renderMenuElement(): React.ReactNode {\n const { valueMap, 'data-testid': dataTestId } = this.props;\n return (\n <div className=\"hcm-menu-container\">\n {Array.from(valueMap.entries()).map(([parent, children]) => (\n <div key={parent}>\n <Checkbox\n className=\"hcm-parent\"\n checked={HierarchicalCheckboxMenu.isParentSelected(\n parent,\n valueMap\n )}\n onChange={() => this.toggleValueFor(parent)}\n >\n {parent}\n </Checkbox>\n {children !== undefined &&\n typeof children !== 'boolean' &&\n Array.from(children.entries()).map(([child, value]) => (\n <Checkbox\n className=\"hcm-child\"\n key={child}\n checked={value}\n onChange={() => this.toggleValueFor(parent, child)}\n >\n {child}\n </Checkbox>\n ))}\n </div>\n ))}\n <Button\n kind=\"ghost\"\n onClick={this.selectAll}\n data-testid={\n dataTestId !== undefined\n ? `${dataTestId}-btn-select-all`\n : undefined\n }\n >\n Select All\n </Button>\n <Button\n kind=\"ghost\"\n onClick={this.clear}\n data-testid={\n dataTestId !== undefined ? `${dataTestId}-btn-clear` : undefined\n }\n >\n Clear\n </Button>\n </div>\n );\n }\n\n render(): JSX.Element {\n const {\n menuText,\n className,\n icon,\n id,\n 'data-testid': dataTestId,\n } = this.props;\n const { menuIsOpen } = this.state;\n\n return (\n <button\n type=\"button\"\n className={classNames('btn hcm-btn', className)}\n onClick={this.toggleMenu}\n id={id}\n data-testid={dataTestId}\n >\n <span>\n {icon && <FontAwesomeIcon icon={icon} className=\"hcm-icon mr-1\" />}\n {menuText}\n </span>\n <span className=\"cs-caret\" />\n <Popper\n options={{ placement: 'bottom' }}\n isShown={menuIsOpen}\n onExited={() => {\n this.setState({ menuIsOpen: false });\n }}\n closeOnBlur\n interactive\n >\n {this.renderMenuElement()}\n </Popper>\n </button>\n );\n }\n}\n\nexport default HierarchicalCheckboxMenu;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,OAAOC,UAAU,MAAM,YAAY;AAAC,OAC7BC,QAAQ;AAAA,OACRC,MAAM;AAAA;AAAA,OAENC,MAAM;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAq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IAAI,CAACnC,QAAQ,CAAC;YAAEJ,UAAU,EAAE;UAAM,CAAC,CAAC;QACtC,CAAE;QACFwC,WAAW;QACXC,WAAW;QAAA1D,QAAA,EAEV,IAAI,CAACqC,iBAAiB,CAAC;MAAC,CACnB,CAAC;IAAA,CACH,CAAC;EAEb;AACF;AAACsB,eAAA,CAxNK/D,wBAAwB,kBAIkC;EAC5D2C,SAAS,EAAE,EAAE;EACbW,IAAI,EAAE,IAAI;EACVC,EAAE,EAAE,EAAE;EACN,aAAa,EAAEjD;AACjB,CAAC;AAiNH,eAAeN,wBAAwB"}
package/dist/Select.d.ts CHANGED
@@ -10,6 +10,6 @@ export type SelectProps = baseSelectProps & {
10
10
  * native select element.
11
11
  * @param props.onChange returns a string value and not the event
12
12
  */
13
- declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "className" | "pattern" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "start" | "children" | "id" | "accept" | "alt" | "capture" | "checked" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "readOnly" | "required" | "size" | "src" | "step" | "useMap" | "width" | "onClick" | "tabIndex" | "role" | "aria-label" | "content" | "default" | "wrap" | "open" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "autoComplete" | "isInvalid" | "onKeyUp" | "lang" | "media" | "method" | "target" | "crossOrigin" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "rows" | "download" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind" | "htmlFor" | "action" | "nonce" | "selected" | "acceptCharset" | "allowFullScreen" | "allowTransparency" | "as" | "async" | "autoPlay" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "dateTime" | "defer" | "encType" | "frameBorder" | "headers" | "high" | "hrefLang" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "mediaGroup" | "muted" | "noValidate" | "optimum" | "playsInline" | "poster" | "preload" | "rel" | "reversed" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "srcDoc" | "srcLang" | "srcSet" | "wmode"> & React.RefAttributes<HTMLSelectElement>>;
13
+ declare const Select: React.ForwardRefExoticComponent<Pick<SelectProps, "className" | "pattern" | "placeholder" | "value" | "onChange" | "onSelect" | "onSubmit" | "onFocus" | "onBlur" | "data-testid" | "key" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "color" | "hidden" | "type" | "onKeyDown" | "onSelectCapture" | "start" | "children" | "id" | "accept" | "alt" | "capture" | "checked" | "defaultChecked" | "defaultValue" | "disabled" | "formAction" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "list" | "max" | "maxLength" | "min" | "minLength" | "multiple" | "name" | "readOnly" | "required" | "size" | "src" | "step" | "useMap" | "width" | "onClick" | "tabIndex" | "role" | "content" | "default" | "wrap" | "open" | "aria-label" | "href" | "target" | "rel" | "download" | "aria-labelledby" | "aria-describedby" | "aria-details" | "onScroll" | "autoFocus" | "autoComplete" | "isInvalid" | "onKeyUp" | "lang" | "media" | "method" | "crossOrigin" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "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" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "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" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "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" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "rows" | "spellCheck" | "formEncType" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "kind" | "htmlFor" | "action" | "nonce" | "selected" | "acceptCharset" | "allowFullScreen" | "allowTransparency" | "as" | "async" | "autoPlay" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "dateTime" | "defer" | "encType" | "frameBorder" | "headers" | "high" | "hrefLang" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "mediaGroup" | "muted" | "noValidate" | "optimum" | "playsInline" | "poster" | "preload" | "reversed" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "srcDoc" | "srcLang" | "srcSet" | "wmode"> & React.RefAttributes<HTMLSelectElement>>;
14
14
  export default Select;
15
15
  //# sourceMappingURL=Select.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ItemContent.d.ts","sourceRoot":"","sources":["../../src/spectrum/ItemContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAEV,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EAAE,OAAO,EACjB,cAAc,GACf,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAsEvC;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ItemContent.d.ts","sourceRoot":"","sources":["../../src/spectrum/ItemContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAEV,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIzC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EAAE,OAAO,EACjB,cAAc,GACf,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAsEvC;AAED,eAAe,WAAW,CAAC"}
@@ -6,6 +6,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
6
6
  import { Children, cloneElement, isValidElement, useState } from 'react';
7
7
  import cl from 'classnames';
8
8
  import { isElementOfType, useCheckOverflow } from '@deephaven/react-hooks';
9
+ import { NON_BREAKING_SPACE } from '@deephaven/utils';
9
10
  import { Text } from "./Text.js";
10
11
  import ItemTooltip from "./ItemTooltip.js";
11
12
  import stylesCommon from "../SpectrumComponent.module.css";
@@ -43,7 +44,7 @@ export function ItemContent(_ref) {
43
44
  /* eslint-disable no-param-reassign */
44
45
  if (content === '') {
45
46
  // Prevent the item height from collapsing when the content is empty
46
- content = '\xa0'; // Non-breaking space
47
+ content = NON_BREAKING_SPACE;
47
48
  } else if (typeof content === 'boolean') {
48
49
  // Boolean values need to be stringified to render
49
50
  content = String(content);
@@ -1 +1 @@
1
- {"version":3,"file":"ItemContent.js","names":["Children","cloneElement","isValidElement","useState","cl","isElementOfType","useCheckOverflow","Text","ItemTooltip","stylesCommon","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ItemContent","_ref","children","content","tooltipOptions","checkOverflow","isOverflowing","resetIsOverflowing","previousContent","setPreviousContent","String","Array","isArray","map","el","_objectSpread","props","ref","UNSAFE_className","spectrumEllipsis","tooltip","options"],"sources":["../../src/spectrum/ItemContent.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n isValidElement,\n ReactNode,\n useState,\n} from 'react';\nimport cl from 'classnames';\nimport { isElementOfType, useCheckOverflow } from '@deephaven/react-hooks';\nimport { Text } from './Text';\nimport { TooltipOptions } from './utils';\nimport ItemTooltip from './ItemTooltip';\nimport stylesCommon from '../SpectrumComponent.module.scss';\n\nexport interface ItemContentProps {\n children: ReactNode;\n tooltipOptions?: TooltipOptions | null;\n}\n\n/**\n * Item content. Text content will be wrapped in a Spectrum Text\n * component with ellipsis overflow handling. If text content overflows and\n * tooltipOptions are provided a tooltip will be displayed when hovering over\n * the item content.\n */\nexport function ItemContent({\n children: content,\n tooltipOptions,\n}: ItemContentProps): JSX.Element | null {\n const { checkOverflow, isOverflowing, resetIsOverflowing } =\n useCheckOverflow();\n\n const [previousContent, setPreviousContent] = useState(content);\n\n // Reset `isOverflowing` if content changes. It will get re-calculated as\n // `Text` components render.\n if (previousContent !== content) {\n setPreviousContent(content);\n resetIsOverflowing();\n }\n\n if (isValidElement(content)) {\n return content;\n }\n\n /* eslint-disable no-param-reassign */\n if (content === '') {\n // Prevent the item height from collapsing when the content is empty\n content = '\\xa0'; // Non-breaking space\n } else if (typeof content === 'boolean') {\n // Boolean values need to be stringified to render\n content = String(content);\n } else if (Array.isArray(content)) {\n // For cases where there are multiple `Text` children, add a css class to\n // handle overflow. The primary use case for multiple text nodes is when a\n // description is provided for an item. e.g.\n // <Item textValue=\"Some Text\">\n // <SomeIcon />\n // <Text>Some Label</Text>\n // <Text slot=\"description\">Some Description</Text>\n // </Item>\n content = Children.map(content, el =>\n isElementOfType(el, Text)\n ? cloneElement(el, {\n ...el.props,\n ref: checkOverflow,\n UNSAFE_className: cl(\n el.props.UNSAFE_className,\n stylesCommon.spectrumEllipsis\n ),\n })\n : el\n );\n }\n\n if (typeof content === 'string' || typeof content === 'number') {\n content = (\n <Text\n ref={checkOverflow}\n UNSAFE_className={stylesCommon.spectrumEllipsis}\n >\n {content}\n </Text>\n );\n }\n /* eslint-enable no-param-reassign */\n\n const tooltip =\n tooltipOptions == null || !isOverflowing ? null : (\n <ItemTooltip options={tooltipOptions}>{content}</ItemTooltip>\n );\n\n return (\n <>\n {content}\n {tooltip}\n </>\n );\n}\n\nexport default ItemContent;\n"],"mappings":";;;;;AAAA,SACEA,QAAQ,EACRC,YAAY,EACZC,cAAc,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AA,aAAA,KACVD,EAAE,CAACE,KAAK;MACXC,GAAG,EAAEZ,aAAa;MAClBa,gBAAgB,EAAE9B,EAAE,CAClB0B,EAAE,CAACE,KAAK,CAACE,gBAAgB,EACzBzB,YAAY,CAAC0B,gBACf;IAAC,EACF,CAAC,GACFL,EACN,CAAC;EACH;EAEA,IAAI,OAAOX,OAAO,KAAK,QAAQ,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC9DA,OAAO,gBACLR,IAAA,CAACJ,IAAI;MACH0B,GAAG,EAAEZ,aAAc;MACnBa,gBAAgB,EAAEzB,YAAY,CAAC0B,gBAAiB;MAAAjB,QAAA,EAE/CC;IAAO,CACJ,CACP;EACH;EACA;;EAEA,IAAMiB,OAAO,GACXhB,cAAc,IAAI,IAAI,IAAI,CAACE,aAAa,GAAG,IAAI,gBAC7CX,IAAA,CAACH,WAAW;IAAC6B,OAAO,EAAEjB,cAAe;IAAAF,QAAA,EAAEC;EAAO,CAAc,CAC7D;EAEH,oBACEJ,KAAA,CAAAF,SAAA;IAAAK,QAAA,GACGC,OAAO,EACPiB,OAAO;EAAA,CACR,CAAC;AAEP;AAEA,eAAepB,WAAW"}
1
+ {"version":3,"file":"ItemContent.js","names":["Children","cloneElement","isValidElement","useState","cl","isElementOfType","useCheckOverflow","NON_BREAKING_SPACE","Text","ItemTooltip","stylesCommon","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ItemContent","_ref","children","content","tooltipOptions","checkOverflow","isOverflowing","resetIsOverflowing","previousContent","setPreviousContent","String","Array","isArray","map","el","_objectSpread","props","ref","UNSAFE_className","spectrumEllipsis","tooltip","options"],"sources":["../../src/spectrum/ItemContent.tsx"],"sourcesContent":["import {\n Children,\n cloneElement,\n isValidElement,\n ReactNode,\n useState,\n} from 'react';\nimport cl from 'classnames';\nimport { isElementOfType, useCheckOverflow } from '@deephaven/react-hooks';\nimport { NON_BREAKING_SPACE } from '@deephaven/utils';\nimport { Text } from './Text';\nimport { TooltipOptions } from './utils';\nimport ItemTooltip from './ItemTooltip';\nimport stylesCommon from '../SpectrumComponent.module.scss';\n\nexport interface ItemContentProps {\n children: ReactNode;\n tooltipOptions?: TooltipOptions | null;\n}\n\n/**\n * Item content. Text content will be wrapped in a Spectrum Text\n * component with ellipsis overflow handling. If text content overflows and\n * tooltipOptions are provided a tooltip will be displayed when hovering over\n * the item content.\n */\nexport function ItemContent({\n children: content,\n tooltipOptions,\n}: ItemContentProps): JSX.Element | null {\n const { checkOverflow, isOverflowing, resetIsOverflowing } =\n useCheckOverflow();\n\n const [previousContent, setPreviousContent] = useState(content);\n\n // Reset `isOverflowing` if content changes. It will get re-calculated as\n // `Text` components render.\n if (previousContent !== content) {\n setPreviousContent(content);\n resetIsOverflowing();\n }\n\n if (isValidElement(content)) {\n return content;\n }\n\n /* eslint-disable no-param-reassign */\n if (content === '') {\n // Prevent the item height from collapsing when the content is empty\n content = NON_BREAKING_SPACE;\n } else if (typeof content === 'boolean') {\n // Boolean values need to be stringified to render\n content = String(content);\n } else if (Array.isArray(content)) {\n // For cases where there are multiple `Text` children, add a css class to\n // handle overflow. The primary use case for multiple text nodes is when a\n // description is provided for an item. e.g.\n // <Item textValue=\"Some Text\">\n // <SomeIcon />\n // <Text>Some Label</Text>\n // <Text slot=\"description\">Some Description</Text>\n // </Item>\n content = Children.map(content, el =>\n isElementOfType(el, Text)\n ? cloneElement(el, {\n ...el.props,\n ref: checkOverflow,\n UNSAFE_className: cl(\n el.props.UNSAFE_className,\n stylesCommon.spectrumEllipsis\n ),\n })\n : el\n );\n }\n\n if (typeof content === 'string' || typeof content === 'number') {\n content = (\n <Text\n ref={checkOverflow}\n UNSAFE_className={stylesCommon.spectrumEllipsis}\n >\n {content}\n </Text>\n );\n }\n /* eslint-enable no-param-reassign */\n\n const tooltip =\n tooltipOptions == null || !isOverflowing ? null : (\n <ItemTooltip options={tooltipOptions}>{content}</ItemTooltip>\n );\n\n return (\n <>\n {content}\n {tooltip}\n </>\n );\n}\n\nexport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AAE,IAChC1B,eAAe,CAAC0B,EAAE,EAAEvB,IAAI,CAAC,gBACrBP,YAAY,CAAC8B,EAAE,EAAAC,aAAA,CAAAA,aAAA,KACVD,EAAE,CAACE,KAAK;MACXC,GAAG,EAAEZ,aAAa;MAClBa,gBAAgB,EAAE/B,EAAE,CAClB2B,EAAE,CAACE,KAAK,CAACE,gBAAgB,EACzBzB,YAAY,CAAC0B,gBACf;IAAC,EACF,CAAC,GACFL,EACN,CAAC;EACH;EAEA,IAAI,OAAOX,OAAO,KAAK,QAAQ,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC9DA,OAAO,gBACLR,IAAA,CAACJ,IAAI;MACH0B,GAAG,EAAEZ,aAAc;MACnBa,gBAAgB,EAAEzB,YAAY,CAAC0B,gBAAiB;MAAAjB,QAAA,EAE/CC;IAAO,CACJ,CACP;EACH;EACA;;EAEA,IAAMiB,OAAO,GACXhB,cAAc,IAAI,IAAI,IAAI,CAACE,aAAa,GAAG,IAAI,gBAC7CX,IAAA,CAACH,WAAW;IAAC6B,OAAO,EAAEjB,cAAe;IAAAF,QAAA,EAAEC;EAAO,CAAc,CAC7D;EAEH,oBACEJ,KAAA,CAAAF,SAAA;IAAAK,QAAA,GACGC,OAAO,EACPiB,OAAO;EAAA,CACR,CAAC;AAEP;AAEA,eAAepB,WAAW"}
@@ -1,15 +1,13 @@
1
1
  /// <reference types="react" />
2
- import { NormalizedSpectrumPickerProps, NormalizedItem, ItemOrSection, TooltipOptions, ItemKey } from '../utils/itemUtils';
2
+ import { NormalizedSpectrumPickerProps, ItemOrSection, ItemKey, TooltipOptions } from '../utils/itemUtils';
3
3
  export type PickerProps = {
4
- children: ItemOrSection | ItemOrSection[] | NormalizedItem[];
4
+ children: ItemOrSection | ItemOrSection[];
5
5
  /** Can be set to true or a TooltipOptions to enable item tooltips */
6
6
  tooltip?: boolean | TooltipOptions;
7
7
  /** The currently selected key in the collection (controlled). */
8
8
  selectedKey?: ItemKey | null;
9
9
  /** The initial selected key in the collection (uncontrolled). */
10
10
  defaultSelectedKey?: ItemKey;
11
- /** Function to retrieve initial scroll position when opening the picker */
12
- getInitialScrollPosition?: () => Promise<number | null>;
13
11
  /**
14
12
  * Handler that is called when the selection change.
15
13
  * Note that under the hood, this is just an alias for Spectrum's
@@ -27,11 +25,11 @@ export type PickerProps = {
27
25
  } & Omit<NormalizedSpectrumPickerProps, 'children' | 'items' | 'onSelectionChange' | 'selectedKey' | 'defaultSelectedKey'>;
28
26
  /**
29
27
  * Picker component for selecting items from a list of items. Items can be
30
- * provided via the `items` prop or as children. Each item can be a string,
31
- * number, boolean, or a Spectrum <Item> element. The remaining props are just
32
- * pass through props for the Spectrum Picker component.
28
+ * provided via the `children` prop. Each item can be a string, number, boolean,
29
+ * or a Spectrum <Item> element. The remaining props are just pass through props
30
+ * for the Spectrum Picker component.
33
31
  * See https://react-spectrum.adobe.com/react-spectrum/Picker.html
34
32
  */
35
- export declare function Picker({ children, tooltip, defaultSelectedKey, selectedKey, getInitialScrollPosition, onChange, onOpenChange, onScroll, onSelectionChange, UNSAFE_className, ...spectrumPickerProps }: PickerProps): JSX.Element;
33
+ export declare function Picker({ children, tooltip, defaultSelectedKey, selectedKey, onChange, onOpenChange, onScroll, onSelectionChange, UNSAFE_className, ...spectrumPickerProps }: PickerProps): JSX.Element;
36
34
  export default Picker;
37
35
  //# sourceMappingURL=Picker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/Picker.tsx"],"names":[],"mappings":";AAcA,OAAO,EAEL,6BAA6B,EAG7B,cAAc,EACd,aAAa,EACb,cAAc,EACd,OAAO,EAER,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,aAAa,GAAG,aAAa,EAAE,GAAG,cAAc,EAAE,CAAC;IAC7D,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,iE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,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAElC,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAElC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,GAKK,IAAI,CACR,6BAA6B,EAC3B,UAAU,GACV,OAAO,GACP,mBAAmB,GACnB,aAAa,GACb,oBAAoB,CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAc,EACd,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,QAAyB,EACzB,iBAAiB,EAEjB,gBAAgB,EAChB,GAAG,mBAAmB,EACvB,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAuF3B;AAED,eAAe,MAAM,CAAC"}
@@ -1,25 +1,27 @@
1
- var _excluded = ["children", "tooltip", "defaultSelectedKey", "selectedKey", "getInitialScrollPosition", "onChange", "onOpenChange", "onScroll", "onSelectionChange", "UNSAFE_className"];
1
+ var _excluded = ["children", "tooltip", "defaultSelectedKey", "selectedKey", "onChange", "onOpenChange", "onScroll", "onSelectionChange", "UNSAFE_className"];
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
6
6
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
7
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
8
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
9
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
8
10
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
9
- import { useCallback, useMemo } from 'react';
11
+ import { useCallback, useMemo, useState } from 'react';
10
12
  import { Picker as SpectrumPicker } from '@adobe/react-spectrum';
11
- import { getPositionOfSelectedItem, findSpectrumPickerScrollArea, usePopoverOnScrollRef } from '@deephaven/react-hooks';
12
- import { EMPTY_FUNCTION, PICKER_ITEM_HEIGHT, PICKER_TOP_OFFSET } from '@deephaven/utils';
13
13
  import cl from 'classnames';
14
- import { isNormalizedSection, normalizeItemList, normalizeTooltipOptions, getItemKey } from "../utils/itemUtils.js";
15
- import { Section } from "../shared.js";
16
- import { useRenderNormalizedItem } from "../utils/index.js";
14
+ import { EMPTY_FUNCTION, PICKER_ITEM_HEIGHTS, PICKER_TOP_OFFSET } from '@deephaven/utils';
15
+ import { getPositionOfSelectedItemElement, normalizeTooltipOptions, isItemElementWithDescription, isSectionElement } from "../utils/itemUtils.js";
16
+ import { wrapItemChildren } from "../utils/itemWrapperUtils.js";
17
+ import usePickerScrollOnOpen from "./usePickerScrollOnOpen.js";
18
+ import { useSpectrumThemeProvider } from "../../theme/index.js";
17
19
  import { jsx as _jsx } from "react/jsx-runtime";
18
20
  /**
19
21
  * Picker component for selecting items from a list of items. Items can be
20
- * provided via the `items` prop or as children. Each item can be a string,
21
- * number, boolean, or a Spectrum <Item> element. The remaining props are just
22
- * pass through props for the Spectrum Picker component.
22
+ * provided via the `children` prop. Each item can be a string, number, boolean,
23
+ * or a Spectrum <Item> element. The remaining props are just pass through props
24
+ * for the Spectrum Picker component.
23
25
  * See https://react-spectrum.adobe.com/react-spectrum/Picker.html
24
26
  */
25
27
  export function Picker(_ref) {
@@ -28,7 +30,6 @@ export function Picker(_ref) {
28
30
  tooltip = true,
29
31
  defaultSelectedKey,
30
32
  selectedKey,
31
- getInitialScrollPosition,
32
33
  onChange,
33
34
  onOpenChange,
34
35
  onScroll = EMPTY_FUNCTION,
@@ -37,63 +38,57 @@ export function Picker(_ref) {
37
38
  UNSAFE_className
38
39
  } = _ref,
39
40
  spectrumPickerProps = _objectWithoutProperties(_ref, _excluded);
40
- var normalizedItems = useMemo(() => normalizeItemList(children), [children]);
41
+ var {
42
+ scale
43
+ } = useSpectrumThemeProvider();
44
+ var itemHeight = PICKER_ITEM_HEIGHTS[scale];
41
45
  var tooltipOptions = useMemo(() => normalizeTooltipOptions(tooltip), [tooltip]);
42
- var renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);
43
- var getInitialScrollPositionInternal = useCallback(() => getInitialScrollPosition == null ? getPositionOfSelectedItem({
44
- keyedItems: normalizedItems,
45
- // TODO: #1890 & deephaven-plugins#371 add support for sections and
46
- // items with descriptions since they impact the height calculations
47
- itemHeight: PICKER_ITEM_HEIGHT,
48
- selectedKey,
49
- topOffset: PICKER_TOP_OFFSET
50
- }) : getInitialScrollPosition(), [getInitialScrollPosition, normalizedItems, selectedKey]);
46
+
47
+ // `null` is a valid value for `selectedKey` in controlled mode, so we check
48
+ // for explicit `undefined` to identify uncontrolled mode.
49
+ var isUncontrolled = selectedKey === undefined;
50
+ var [uncontrolledSelectedKey, setUncontrolledSelectedKey] = useState(defaultSelectedKey);
51
+ var wrappedItems = useMemo(() => wrapItemChildren(children, tooltipOptions), [children, tooltipOptions]);
52
+
53
+ // Item descriptions and Section elements introduce variable item heights.
54
+ // This throws off scroll position calculations, so we disable auto scrolling
55
+ // if either of these are found.
56
+ var disableScrollOnOpen = useMemo(() => wrappedItems.some(item => isSectionElement(item) || isItemElementWithDescription(item)), [wrappedItems]);
57
+ var getInitialScrollPosition = useCallback( /*#__PURE__*/_asyncToGenerator(function* () {
58
+ return disableScrollOnOpen ? null : getPositionOfSelectedItemElement({
59
+ items: wrappedItems,
60
+ itemHeight,
61
+ selectedKey: isUncontrolled ? uncontrolledSelectedKey : selectedKey,
62
+ topOffset: PICKER_TOP_OFFSET
63
+ });
64
+ }), [disableScrollOnOpen, isUncontrolled, itemHeight, selectedKey, uncontrolledSelectedKey, wrappedItems]);
65
+ var onSelectionChangeInternal = useCallback(key => {
66
+ var _ref3;
67
+ // If our component is uncontrolled, track the selected key internally
68
+ // so that we can scroll to the selected item if the user re-opens
69
+ if (isUncontrolled) {
70
+ setUncontrolledSelectedKey(key);
71
+ }
72
+ (_ref3 = onChange !== null && onChange !== void 0 ? onChange : onSelectionChange) === null || _ref3 === void 0 ? void 0 : _ref3(key);
73
+ }, [isUncontrolled, onChange, onSelectionChange]);
51
74
  var {
52
75
  ref: scrollRef,
53
- onOpenChange: popoverOnOpenChange
54
- } = usePopoverOnScrollRef(findSpectrumPickerScrollArea, onScroll, getInitialScrollPositionInternal);
55
- var onOpenChangeInternal = useCallback(isOpen => {
56
- // Attach scroll event handling
57
- popoverOnOpenChange(isOpen);
58
- onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
59
- }, [onOpenChange, popoverOnOpenChange]);
60
- var onSelectionChangeInternal = useCallback(key => {
61
- var _getItemKey, _ref2;
62
- // The `key` arg will always be a string due to us setting the `Item` key
63
- // prop in `renderItem`. We need to find the matching item to determine
64
- // the actual key.
65
- var selectedItem = normalizedItems.find(item => String(getItemKey(item)) === key);
66
- var actualKey = (_getItemKey = getItemKey(selectedItem)) !== null && _getItemKey !== void 0 ? _getItemKey : key;
67
- (_ref2 = onChange !== null && onChange !== void 0 ? onChange : onSelectionChange) === null || _ref2 === void 0 ? void 0 : _ref2(actualKey);
68
- }, [normalizedItems, onChange, onSelectionChange]);
76
+ onOpenChange: onOpenChangeInternal
77
+ } = usePickerScrollOnOpen({
78
+ getInitialScrollPosition,
79
+ onScroll,
80
+ onOpenChange
81
+ });
69
82
  return /*#__PURE__*/_jsx(SpectrumPicker
70
83
  // eslint-disable-next-line react/jsx-props-no-spreading
71
84
  , _objectSpread(_objectSpread({}, spectrumPickerProps), {}, {
72
85
  ref: scrollRef,
73
- onOpenChange: onOpenChangeInternal,
74
86
  UNSAFE_className: cl('dh-picker', UNSAFE_className),
75
- items: normalizedItems
76
- // Spectrum Picker treats keys as strings if the `key` prop is explicitly
77
- // set on `Item` elements. Since we do this in `renderItem`, we need to
78
- // ensure that `selectedKey` and `defaultSelectedKey` are strings in order
79
- // for selection to work.
80
- ,
81
- selectedKey: selectedKey == null ? selectedKey : selectedKey.toString(),
82
- defaultSelectedKey: defaultSelectedKey == null ? defaultSelectedKey : defaultSelectedKey.toString()
83
- // `onChange` is just an alias for `onSelectionChange`
84
- ,
87
+ selectedKey: selectedKey,
88
+ defaultSelectedKey: defaultSelectedKey,
85
89
  onSelectionChange: onSelectionChangeInternal,
86
- children: itemOrSection => {
87
- if (isNormalizedSection(itemOrSection)) {
88
- var _itemOrSection$item, _itemOrSection$item2;
89
- return /*#__PURE__*/_jsx(Section, {
90
- title: (_itemOrSection$item = itemOrSection.item) === null || _itemOrSection$item === void 0 ? void 0 : _itemOrSection$item.title,
91
- items: (_itemOrSection$item2 = itemOrSection.item) === null || _itemOrSection$item2 === void 0 ? void 0 : _itemOrSection$item2.items,
92
- children: renderNormalizedItem
93
- }, getItemKey(itemOrSection));
94
- }
95
- return renderNormalizedItem(itemOrSection);
96
- }
90
+ onOpenChange: onOpenChangeInternal,
91
+ children: wrappedItems
97
92
  }));
98
93
  }
99
94
  export default Picker;
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.js","names":["useCallback","useMemo","Picker","SpectrumPicker","getPositionOfSelectedItem","findSpectrumPickerScrollArea","usePopoverOnScrollRef","EMPTY_FUNCTION","PICKER_ITEM_HEIGHT","PICKER_TOP_OFFSET","cl","isNormalizedSection","normalizeItemList","normalizeTooltipOptions","getItemKey","Section","useRenderNormalizedItem","jsx","_jsx","_ref","children","tooltip","defaultSelectedKey","selectedKey","getInitialScrollPosition","onChange","onOpenChange","onScroll","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","normalizedItems","tooltipOptions","renderNormalizedItem","getInitialScrollPositionInternal","keyedItems","itemHeight","topOffset","ref","scrollRef","popoverOnOpenChange","onOpenChangeInternal","isOpen","onSelectionChangeInternal","key","_getItemKey","_ref2","selectedItem","find","item","String","actualKey","_objectSpread","items","toString","itemOrSection","_itemOrSection$item","_itemOrSection$item2","title"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { DOMRef } from '@react-types/shared';\nimport { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport {\n getPositionOfSelectedItem,\n findSpectrumPickerScrollArea,\n usePopoverOnScrollRef,\n} from '@deephaven/react-hooks';\nimport {\n EMPTY_FUNCTION,\n PICKER_ITEM_HEIGHT,\n PICKER_TOP_OFFSET,\n} from '@deephaven/utils';\nimport cl from 'classnames';\nimport {\n isNormalizedSection,\n NormalizedSpectrumPickerProps,\n normalizeItemList,\n normalizeTooltipOptions,\n NormalizedItem,\n ItemOrSection,\n TooltipOptions,\n ItemKey,\n getItemKey,\n} from '../utils/itemUtils';\nimport { Section } from '../shared';\nimport { useRenderNormalizedItem } from '../utils';\n\nexport type PickerProps = {\n children: ItemOrSection | ItemOrSection[] | NormalizedItem[];\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n /** Function to retrieve initial scroll position when opening the picker */\n getInitialScrollPosition?: () => Promise<number | null>;\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: ItemKey) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: ItemKey) => void;\n} /*\n * Support remaining SpectrumPickerProps.\n * Note that `selectedKey`, `defaultSelectedKey`, and `onSelectionChange` are\n * re-defined above to account for boolean types which aren't included in the\n * React `Key` type, but are actually supported by the Spectrum Picker component.\n */ & Omit<\n NormalizedSpectrumPickerProps,\n | 'children'\n | 'items'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n>;\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `items` prop or as children. Each item can be a string,\n * number, boolean, or a Spectrum <Item> element. The remaining props are just\n * pass through props for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n children,\n tooltip = true,\n defaultSelectedKey,\n selectedKey,\n getInitialScrollPosition,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n // eslint-disable-next-line camelcase\n UNSAFE_className,\n ...spectrumPickerProps\n}: PickerProps): JSX.Element {\n const normalizedItems = useMemo(\n () => normalizeItemList(children),\n [children]\n );\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n const renderNormalizedItem = useRenderNormalizedItem(tooltipOptions);\n\n const getInitialScrollPositionInternal = useCallback(\n () =>\n getInitialScrollPosition == null\n ? getPositionOfSelectedItem({\n keyedItems: normalizedItems,\n // TODO: #1890 & deephaven-plugins#371 add support for sections and\n // items with descriptions since they impact the height calculations\n itemHeight: PICKER_ITEM_HEIGHT,\n selectedKey,\n topOffset: PICKER_TOP_OFFSET,\n })\n : getInitialScrollPosition(),\n [getInitialScrollPosition, normalizedItems, selectedKey]\n );\n\n const { ref: scrollRef, onOpenChange: popoverOnOpenChange } =\n usePopoverOnScrollRef(\n findSpectrumPickerScrollArea,\n onScroll,\n getInitialScrollPositionInternal\n );\n\n const onOpenChangeInternal = useCallback(\n (isOpen: boolean): void => {\n // Attach scroll event handling\n popoverOnOpenChange(isOpen);\n\n onOpenChange?.(isOpen);\n },\n [onOpenChange, popoverOnOpenChange]\n );\n\n const onSelectionChangeInternal = useCallback(\n (key: ItemKey): void => {\n // The `key` arg will always be a string due to us setting the `Item` key\n // prop in `renderItem`. We need to find the matching item to determine\n // the actual key.\n const selectedItem = normalizedItems.find(\n item => String(getItemKey(item)) === key\n );\n\n const actualKey = getItemKey(selectedItem) ?? key;\n\n (onChange ?? onSelectionChange)?.(actualKey);\n },\n [normalizedItems, onChange, onSelectionChange]\n );\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n ref={scrollRef as unknown as DOMRef<HTMLDivElement>}\n onOpenChange={onOpenChangeInternal}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n items={normalizedItems}\n // Spectrum Picker treats keys as strings if the `key` prop is explicitly\n // set on `Item` elements. Since we do this in `renderItem`, we need to\n // ensure that `selectedKey` and `defaultSelectedKey` are strings in order\n // for selection to work.\n selectedKey={selectedKey == null ? selectedKey : selectedKey.toString()}\n defaultSelectedKey={\n defaultSelectedKey == null\n ? defaultSelectedKey\n : defaultSelectedKey.toString()\n }\n // `onChange` is just an alias for `onSelectionChange`\n onSelectionChange={\n onSelectionChangeInternal as NormalizedSpectrumPickerProps['onSelectionChange']\n }\n >\n {itemOrSection => {\n if (isNormalizedSection(itemOrSection)) {\n return (\n <Section\n key={getItemKey(itemOrSection)}\n title={itemOrSection.item?.title}\n items={itemOrSection.item?.items}\n >\n {renderNormalizedItem}\n </Section>\n );\n }\n\n return renderNormalizedItem(itemOrSection);\n }}\n </SpectrumPicker>\n );\n}\n\nexport default Picker;\n"],"mappings":";;;;;;;;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAE5C,SAASC,MAAM,IAAIC,cAAc,QAAQ,uBAAuB;AAChE,SACEC,yBAAyB,EACzBC,4BAA4B,EAC5BC,qBAAqB,QAChB,wBAAwB;AAC/B,SACEC,cAAc,EACdC,kBAAkB,EAClBC,iBAAiB,QACZ,kBAAkB;AACzB,OAAOC,EAAE,MAAM,YAAY;AAAC,SAE1BC,mBAAmB,EAEnBC,iBAAiB,EACjBC,uBAAuB,EAKvBC,UAAU;AAAA,SAEHC,OAAO;AAAA,SACPC,uBAAuB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AA0ChC;AACA;AACA;AACA;AAC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AAO,mBAAA,uBAAlBA,mBAAA,CAAoBE,KAAM;UACjCL,KAAK,GAAAI,oBAAA,GAAEF,aAAa,CAACN,IAAI,cAAAQ,oBAAA,uBAAlBA,oBAAA,CAAoBJ,KAAM;UAAAnC,QAAA,EAEhCe;QAAoB,GAJhBrB,UAAU,CAAC2C,aAAa,CAKtB,CAAC;MAEd;MAEA,OAAOtB,oBAAoB,CAACsB,aAAa,CAAC;IAC5C;EAAC,EACa,CAAC;AAErB;AAEA,eAAevD,MAAM"}
1
+ {"version":3,"file":"Picker.js","names":["useCallback","useMemo","useState","Picker","SpectrumPicker","cl","EMPTY_FUNCTION","PICKER_ITEM_HEIGHTS","PICKER_TOP_OFFSET","getPositionOfSelectedItemElement","normalizeTooltipOptions","isItemElementWithDescription","isSectionElement","wrapItemChildren","usePickerScrollOnOpen","useSpectrumThemeProvider","jsx","_jsx","_ref","children","tooltip","defaultSelectedKey","selectedKey","onChange","onOpenChange","onScroll","onSelectionChange","UNSAFE_className","spectrumPickerProps","_objectWithoutProperties","_excluded","scale","itemHeight","tooltipOptions","isUncontrolled","undefined","uncontrolledSelectedKey","setUncontrolledSelectedKey","wrappedItems","disableScrollOnOpen","some","item","getInitialScrollPosition","_asyncToGenerator","items","topOffset","onSelectionChangeInternal","key","_ref3","ref","scrollRef","onOpenChangeInternal","_objectSpread"],"sources":["../../../src/spectrum/picker/Picker.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport type { DOMRef } from '@react-types/shared';\nimport { Picker as SpectrumPicker } from '@adobe/react-spectrum';\nimport cl from 'classnames';\nimport {\n EMPTY_FUNCTION,\n PICKER_ITEM_HEIGHTS,\n PICKER_TOP_OFFSET,\n} from '@deephaven/utils';\nimport {\n NormalizedSpectrumPickerProps,\n ItemOrSection,\n getPositionOfSelectedItemElement,\n ItemKey,\n normalizeTooltipOptions,\n TooltipOptions,\n isItemElementWithDescription,\n isSectionElement,\n} from '../utils/itemUtils';\nimport { wrapItemChildren } from '../utils/itemWrapperUtils';\nimport usePickerScrollOnOpen from './usePickerScrollOnOpen';\nimport { useSpectrumThemeProvider } from '../../theme';\n\nexport type PickerProps = {\n children: ItemOrSection | ItemOrSection[];\n\n /** Can be set to true or a TooltipOptions to enable item tooltips */\n tooltip?: boolean | TooltipOptions;\n\n /** The currently selected key in the collection (controlled). */\n selectedKey?: ItemKey | null;\n\n /** The initial selected key in the collection (uncontrolled). */\n defaultSelectedKey?: ItemKey;\n\n /**\n * Handler that is called when the selection change.\n * Note that under the hood, this is just an alias for Spectrum's\n * `onSelectionChange`. We are renaming for better consistency with other\n * components.\n */\n onChange?: (key: ItemKey) => void;\n\n /** Handler that is called when the picker is scrolled. */\n onScroll?: (event: Event) => void;\n\n /**\n * Handler that is called when the selection changes.\n * @deprecated Use `onChange` instead\n */\n onSelectionChange?: (key: ItemKey) => void;\n} /*\n * Support remaining SpectrumPickerProps.\n * Note that `selectedKey`, `defaultSelectedKey`, and `onSelectionChange` are\n * re-defined above to account for boolean types which aren't included in the\n * React `Key` type, but are actually supported by the Spectrum Picker component.\n */ & Omit<\n NormalizedSpectrumPickerProps,\n | 'children'\n | 'items'\n | 'onSelectionChange'\n | 'selectedKey'\n | 'defaultSelectedKey'\n>;\n\n/**\n * Picker component for selecting items from a list of items. Items can be\n * provided via the `children` prop. Each item can be a string,\tnumber, boolean,\n * or a Spectrum <Item> element. The remaining props are just\tpass through props\n * for the Spectrum Picker component.\n * See https://react-spectrum.adobe.com/react-spectrum/Picker.html\n */\nexport function Picker({\n children,\n tooltip = true,\n defaultSelectedKey,\n selectedKey,\n onChange,\n onOpenChange,\n onScroll = EMPTY_FUNCTION,\n onSelectionChange,\n // eslint-disable-next-line camelcase\n UNSAFE_className,\n ...spectrumPickerProps\n}: PickerProps): JSX.Element {\n const { scale } = useSpectrumThemeProvider();\n const itemHeight = PICKER_ITEM_HEIGHTS[scale];\n\n const tooltipOptions = useMemo(\n () => normalizeTooltipOptions(tooltip),\n [tooltip]\n );\n\n // `null` is a valid value for `selectedKey` in controlled mode, so we check\n // for explicit `undefined` to identify uncontrolled mode.\n const isUncontrolled = selectedKey === undefined;\n const [uncontrolledSelectedKey, setUncontrolledSelectedKey] =\n useState(defaultSelectedKey);\n\n const wrappedItems = useMemo(\n () => wrapItemChildren(children, tooltipOptions),\n [children, tooltipOptions]\n );\n\n // Item descriptions and Section elements introduce variable item heights.\n // This throws off scroll position calculations, so we disable auto scrolling\n // if either of these are found.\n const disableScrollOnOpen = useMemo(\n () =>\n wrappedItems.some(\n item => isSectionElement(item) || isItemElementWithDescription(item)\n ),\n [wrappedItems]\n );\n\n const getInitialScrollPosition = useCallback(\n async () =>\n disableScrollOnOpen\n ? null\n : getPositionOfSelectedItemElement({\n items: wrappedItems,\n itemHeight,\n selectedKey: isUncontrolled ? uncontrolledSelectedKey : selectedKey,\n topOffset: PICKER_TOP_OFFSET,\n }),\n [\n disableScrollOnOpen,\n isUncontrolled,\n itemHeight,\n selectedKey,\n uncontrolledSelectedKey,\n wrappedItems,\n ]\n );\n\n const onSelectionChangeInternal = useCallback(\n (key: ItemKey): void => {\n // If our component is uncontrolled, track the selected key internally\n // so that we can scroll to the selected item if the user re-opens\n if (isUncontrolled) {\n setUncontrolledSelectedKey(key);\n }\n\n (onChange ?? onSelectionChange)?.(key);\n },\n [isUncontrolled, onChange, onSelectionChange]\n );\n\n const { ref: scrollRef, onOpenChange: onOpenChangeInternal } =\n usePickerScrollOnOpen({\n getInitialScrollPosition,\n onScroll,\n onOpenChange,\n });\n\n return (\n <SpectrumPicker\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...spectrumPickerProps}\n ref={scrollRef as DOMRef<HTMLDivElement>}\n UNSAFE_className={cl('dh-picker', UNSAFE_className)}\n selectedKey={selectedKey as NormalizedSpectrumPickerProps['selectedKey']}\n defaultSelectedKey={\n defaultSelectedKey as NormalizedSpectrumPickerProps['defaultSelectedKey']\n }\n onSelectionChange={onSelectionChangeInternal}\n onOpenChange={onOpenChangeInternal}\n >\n {wr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AAW,EAAEsB,gBAAgB,CAAE;IACpDL,WAAW,EAAEA,WAA4D;IACzED,kBAAkB,EAChBA,kBACD;IACDK,iBAAiB,EAAEoB,yBAA0B;IAC7CtB,YAAY,EAAE2B,oBAAqB;IAAAhC,QAAA,EAElCmB;EAAY,EACC,CAAC;AAErB;AAEA,eAAenC,MAAM"}
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ import type { PickerProps as PickerBaseProps } from './Picker';
3
+ import { NormalizedItem, NormalizedSection } from '../utils';
4
+ export interface PickerNormalizedProps extends Omit<PickerBaseProps, 'children'> {
5
+ normalizedItems: (NormalizedItem | NormalizedSection)[];
6
+ getInitialScrollPosition?: () => Promise<number | null | undefined>;
7
+ onScroll?: (event: Event) => void;
8
+ }
9
+ /**
10
+ * Picker that takes an array of `NormalizedItem` or `NormalizedSection` items
11
+ * as children and uses a render item function to render the items. This is
12
+ * necessary to support windowed data.
13
+ */
14
+ export declare function PickerNormalized({ normalizedItems, tooltip, selectedKey, defaultSelectedKey, disabledKeys, UNSAFE_className, getInitialScrollPosition, onChange, onOpenChange, onScroll, onSelectionChange, ...props }: PickerNormalizedProps): JSX.Element;
15
+ export default PickerNormalized;
16
+ //# sourceMappingURL=PickerNormalized.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PickerNormalized.d.ts","sourceRoot":"","sources":["../../../src/spectrum/picker/PickerNormalized.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,EAGL,cAAc,EACd,iBAAiB,EAIlB,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,qBACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC;IACzC,eAAe,EAAE,CAAC,cAAc,GAAG,iBAAiB,CAAC,EAAE,CAAC;IACxD,wBAAwB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACpE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,eAAe,EACf,OAAc,EACd,WAAW,EACX,kBAAkB,EAClB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,QAAQ,EACR,YAAY,EACZ,QAAyB,EACzB,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAiErC;AAED,eAAe,gBAAgB,CAAC"}