diff options
-rw-r--r-- | sw-ui-kt/src/main/kotlin/blueprintjs.kt | 27 | ||||
-rw-r--r-- | sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt | 18 |
2 files changed, 45 insertions, 0 deletions
diff --git a/sw-ui-kt/src/main/kotlin/blueprintjs.kt b/sw-ui-kt/src/main/kotlin/blueprintjs.kt index 81227835..2a2bfdce 100644 --- a/sw-ui-kt/src/main/kotlin/blueprintjs.kt +++ b/sw-ui-kt/src/main/kotlin/blueprintjs.kt @@ -322,6 +322,33 @@ external class Tag : PureComponent<ITagProps, RState> { override fun render(): ReactElement } +external interface INonIdealStateProps : IProps { + /** An action to resolve the non-ideal state which appears after `description`. */ + var action: ReactElement? + + /** + * Advanced usage: React `children` will appear last (after `action`). + * Avoid passing raw strings as they will not receive margins and disrupt the layout flow. + */ + var children: ReactElement? + + /** + * A longer description of the non-ideal state. + * A string or number value will be wrapped in a `<div>` to preserve margins. + */ + var description: ReactElement? + + /** The name of a Blueprint icon or a JSX Element (such as `<Spinner/>`) to render above the title. */ + var icon: IconName? + + /** The title of the non-ideal state. */ + var title: ReactElement? +} + +external class NonIdealState : PureComponent<INonIdealStateProps, RState> { + override fun render(): ReactElement? +} + external class Classes { companion object { val HTML_TABLE: String = definedExternally diff --git a/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt b/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt index 0d9cb9bd..1b20423c 100644 --- a/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt +++ b/sw-ui-kt/src/main/kotlin/blueprintjsHelpers.kt @@ -79,3 +79,21 @@ fun RBuilder.bpTag( } block() } + +fun RBuilder.bpNonIdealState( + icon: IconName? = null, + title: ReactElement? = null, + description: ReactElement? = null, + action: ReactElement? = null, + children: ReactElement? = null, + block: RHandler<INonIdealStateProps> = {} +): ReactElement = child(NonIdealState::class) { + attrs { + this.icon = icon + this.title = title + this.description = description + this.action = action + this.children = children + } + block() +} |