summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt127
-rw-r--r--sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt30
2 files changed, 157 insertions, 0 deletions
diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt
new file mode 100644
index 00000000..1c610579
--- /dev/null
+++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt
@@ -0,0 +1,127 @@
+@file:JsModule("@blueprintjs/core")
+package com.palantir.blueprintjs
+
+import org.w3c.dom.HTMLDivElement
+import org.w3c.dom.events.Event
+import react.PureComponent
+import react.RState
+import react.ReactElement
+
+external enum class PopoverInteractionKind {
+ CLICK,
+ CLICK_TARGET_ONLY,
+ HOVER,
+ HOVER_TARGET_ONLY
+}
+
+external enum class PopoverPosition {
+ AUTO,
+ AUTO_END,
+ AUTO_START,
+ BOTTOM,
+ BOTTOM_LEFT,
+ BOTTOM_RIGHT,
+ LEFT,
+ LEFT_BOTTOM,
+ LEFT_TOP,
+ RIGHT,
+ RIGHT_BOTTOM,
+ RIGHT_TOP,
+ TOP,
+ TOP_LEFT,
+ TOP_RIGHT
+}
+
+external interface IPopoverSharedProps : IOverlayableProps, IProps {
+ var boundary: Any?
+ get() = definedExternally
+ set(value) = definedExternally
+ var captureDismiss: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var defaultIsOpen: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var disabled: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var hoverCloseDelay: Number?
+ get() = definedExternally
+ set(value) = definedExternally
+ var hoverOpenDelay: Number?
+ get() = definedExternally
+ set(value) = definedExternally
+ var inheritDarkTheme: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var isOpen: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var modifiers: Any?
+ get() = definedExternally
+ set(value) = definedExternally
+ var onInteraction: ((nextOpenState: Boolean, e: Event) -> Unit)?
+ get() = definedExternally
+ set(value) = definedExternally
+ var openOnTargetFocus: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var popoverClassName: String?
+ get() = definedExternally
+ set(value) = definedExternally
+ var position: PopoverPosition?
+ get() = definedExternally
+ set(value) = definedExternally
+ var targetClassName: String?
+ get() = definedExternally
+ set(value) = definedExternally
+ var targetProps: Any?
+ get() = definedExternally
+ set(value) = definedExternally
+ var targetTagName: Any?
+ get() = definedExternally
+ set(value) = definedExternally
+ override var usePortal: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var wrapperTagName: Any?
+ get() = definedExternally
+ set(value) = definedExternally
+}
+
+external interface IPopoverProps : IPopoverSharedProps {
+ var backdropProps: Any?
+ get() = definedExternally
+ set(value) = definedExternally
+ var content: dynamic /* String? | JSX.Element? */
+ get() = definedExternally
+ set(value) = definedExternally
+ var fill: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var interactionKind: PopoverInteractionKind?
+ get() = definedExternally
+ set(value) = definedExternally
+ var hasBackdrop: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var minimal: Boolean?
+ get() = definedExternally
+ set(value) = definedExternally
+ var popoverRef: ((ref: HTMLDivElement?) -> Unit)?
+ get() = definedExternally
+ set(value) = definedExternally
+ var target: dynamic /* String? | JSX.Element? */
+ get() = definedExternally
+ set(value) = definedExternally
+}
+
+external interface IPopoverState : RState {
+ var transformOrigin: String
+ var isOpen: Boolean
+ var hasDarkParent: Boolean
+}
+
+open external class Popover : PureComponent<IPopoverProps, IPopoverState> {
+ override fun render(): ReactElement
+}
diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
index bf4df032..b7556360 100644
--- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
+++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt
@@ -155,6 +155,36 @@ fun RBuilder.bpOverlay(
block()
}
+fun RBuilder.bpPopover(
+ content: ReactElement,
+ hoverOpenDelay: Number? = null,
+ hoverCloseDelay: Number? = null,
+ position: PopoverPosition = PopoverPosition.AUTO,
+ interactionKind: PopoverInteractionKind = PopoverInteractionKind.HOVER,
+ minimal: Boolean = false,
+ canEscapeKeyClose: Boolean = true,
+ className: String? = null,
+ popoverClassName: String? = null,
+ portalClassName: String? = null,
+ onClose: () -> Unit = {},
+ block: RHandler<IPopoverProps> = {}
+): ReactElement = child(Popover::class) {
+ attrs {
+ this.interactionKind = interactionKind
+ this.minimal = minimal
+ this.content = content
+ this.position = position
+ this.hoverOpenDelay = hoverOpenDelay
+ this.hoverCloseDelay = hoverCloseDelay
+ this.canEscapeKeyClose = canEscapeKeyClose
+ this.className = className
+ this.popoverClassName = popoverClassName
+ this.portalClassName = portalClassName
+ this.onClose = { onClose() }
+ }
+ block()
+}
+
fun RBuilder.bpCallout(
intent: Intent? = Intent.NONE,
icon: IconName? = null,
bgstack15