1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
package com.palantir.blueprintjs
import org.w3c.dom.HTMLElement
import org.w3c.dom.events.Event
import org.w3c.dom.events.MouseEvent
import react.RBuilder
import react.RElementBuilder
import react.RHandler
import react.ReactElement
typealias IconName = String
fun RBuilder.icon(
name: IconName,
size: Int = Icon.SIZE_STANDARD,
intent: Intent = Intent.NONE,
title: String? = null,
alt: String? = null
): ReactElement = child(Icon::class) {
attrs {
this.icon = name
this.iconSize = size
this.htmlTitle = title
this.intent = intent
this.title = alt
}
}
fun RBuilder.bpButton(
minimal: Boolean = false,
large: Boolean = false,
disabled: Boolean = false,
icon: IconName? = null,
rightIcon: IconName? = null,
intent: Intent = Intent.NONE,
onClick: ((event: MouseEvent) -> Unit)?,
block: RHandler<IButtonProps> = {}
): ReactElement = child(Button::class) {
attrs {
this.minimal = minimal
this.large = large
this.disabled = disabled
this.icon = icon
this.rightIcon = rightIcon
this.intent = intent
this.onClick = onClick
}
block()
}
fun RBuilder.inputGroup(
large: Boolean = false,
placeholder: String = "",
rightElement: ReactElement? = null,
onChange: (Event) -> Unit
): ReactElement = child(InputGroup::class) {
attrs {
this.large = large
this.placeholder = placeholder
this.rightElement = rightElement
this.onChange = onChange
}
}
data class ButtonProps(
override var className: String? = null,
override var intent: Intent? = Intent.NONE,
override var disabled: Boolean? = false,
override var icon: IconName? = null,
override var onClick: ((event: MouseEvent) -> Unit)? = null,
override var text: String? = null,
override var active: Boolean? = true,
override var alignText: Alignment? = null,
override var elementRef: ((ref: HTMLElement?) -> Any)? = null,
override var fill: Boolean? = null,
override var large: Boolean? = null,
override var loading: Boolean? = null,
override var minimal: Boolean? = null,
override var outlined: Boolean? = null,
override var rightIcon: IconName? = null,
override var small: Boolean? = null,
override var type: String? = null
) : IButtonProps
|