visionforge/ui/ring/src/main/kotlin/ringui/Dialog.kt

28 lines
945 B
Kotlin
Raw Normal View History

2020-05-16 19:26:28 +03:00
package ringui
import react.RBuilder
import react.RHandler
import react.dom.WithClassName
// https://github.com/JetBrains/ring-ui/blob/master/components/dialog/dialog.js
2021-05-09 11:11:21 +03:00
public external interface DialogProps : WithClassName {
public var contentClassName: String
public var show: Boolean
public var showCloseButton: Boolean
public var onOverlayClick: () -> Unit
public var onEscPress: () -> Unit
public var onCloseClick: () -> Unit
2020-05-16 19:26:28 +03:00
// onCloseAttempt is a common callback for ESC pressing and overlay clicking.
// Use it if you don't need different behaviors for this cases.
2021-05-09 11:11:21 +03:00
public var onCloseAttempt: () -> Unit
2020-05-16 19:26:28 +03:00
// focusTrap may break popups inside dialog, so use it carefully
2021-05-09 11:11:21 +03:00
public var trapFocus: Boolean
public var autoFocusFirst: Boolean
2020-05-16 19:26:28 +03:00
}
2021-05-09 11:11:21 +03:00
public fun RBuilder.ringDialog(show: Boolean, handler: RHandler<DialogProps>) {
2020-05-16 19:26:28 +03:00
RingUI.Dialog {
attrs.show = show
handler()
}
}