diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-09-07 23:36:44 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-09-08 00:39:01 +0200 |
commit | 9cb098df0ad5978b0e9aac78b4c68c9d16759f0f (patch) | |
tree | b7c4829c163a004a012a3da13183753fe4ee32e6 /sw-ui/src/main/kotlin/com | |
parent | Use port 80 in docker image (diff) | |
download | seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.tar.gz seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.tar.bz2 seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.zip |
Format with trailing comma
Diffstat (limited to 'sw-ui/src/main/kotlin/com')
13 files changed, 92 insertions, 13 deletions
diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpButtons.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpButtons.kt index 8b6ce30a..7438e0ba 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpButtons.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpButtons.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.HTMLElement @@ -14,10 +15,13 @@ import react.ReactElement external interface IActionProps : IIntentProps, IProps { /** Whether this action is non-interactive. */ var disabled: Boolean? + /** Name of a Blueprint UI icon (or an icon element) to render before the text. */ var icon: IconName? + /** Click event handler. */ var onClick: ((event: MouseEvent) -> Unit)? + /** Action text. Can be any single React renderable. */ var text: String? } @@ -25,12 +29,14 @@ external interface IActionProps : IIntentProps, IProps { external interface IButtonProps : IActionProps { // artificially added to allow title on button (should probably be on more general props) var title: String? + /** * If set to `true`, the button will display in an active state. * This is equivalent to setting `className={Classes.ACTIVE}`. * @default false */ var active: Boolean? + /** * Text alignment within button. By default, icons and text will be centered * within the button. Passing `"left"` or `"right"` will align the button @@ -39,26 +45,35 @@ external interface IButtonProps : IActionProps { * @default Alignment.CENTER */ var alignText: Alignment? + /** A ref handler that receives the native HTML element backing this component. */ var elementRef: ((ref: HTMLElement?) -> Any)? + /** Whether this button should expand to fill its container. */ var fill: Boolean? + /** Whether this button should use large styles. */ var large: Boolean? + /** * If set to `true`, the button will display a centered loading spinner instead of its contents. * The width of the button is not affected by the value of this prop. * @default false */ var loading: Boolean? + /** Whether this button should use minimal styles. */ var minimal: Boolean? + /** Whether this button should use outlined styles. */ var outlined: Boolean? + /** Name of a Blueprint UI icon (or an icon element) to render after the text. */ var rightIcon: IconName? + /** Whether this button should use small styles. */ var small: Boolean? + /** * HTML `type` attribute of button. Accepted values are `"button"`, `"submit"`, and `"reset"`. * Note that this prop has no effect on `AnchorButton`; it only affects `Button`. @@ -76,6 +91,7 @@ abstract external class AbstractButton : PureComponent<IButtonProps, IButtonStat external class Button : AbstractButton { override fun render(): ReactElement } + external class AnchorButton : AbstractButton { override fun render(): ReactElement } diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt index a812d6e4..15d8a3f9 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import react.PureComponent diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt index dc8961f1..be9977ec 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.events.MouseEvent diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt index 8ccef232..84f5ae31 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import react.PureComponent diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt index 1a602882..a8d45145 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import react.PureComponent diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt index ab277617..54d6bde8 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import react.PureComponent @@ -13,11 +14,13 @@ external interface IIconProps : IIntentProps, IProps { * surrounding text. */ var color: String? + /** * String for the `title` attribute on the rendered element, which will appear * on hover as a native browser tooltip. */ var htmlTitle: String? + /** * Name of a Blueprint UI icon, or an icon element, to render. This prop is * required because it determines the content of the component, but it can @@ -35,6 +38,7 @@ external interface IIconProps : IIntentProps, IProps { * `<Element />` instead. */ var icon: IconName + /** * Size of the icon, in pixels. Blueprint contains 16px and 20px SVG icon * images, and chooses the appropriate resolution based on this prop. @@ -48,6 +52,7 @@ external interface IIconProps : IIntentProps, IProps { * @default "span" */ var tagName: String? // keyof JSX.IntrinsicElements + /** * Description string. This string does not appear in normal browsers, but * it increases accessibility. For instance, screen readers will use it for diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt index 4eaadb78..90178a9b 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.HTMLInputElement @@ -13,30 +14,39 @@ external interface IInputGroupProps : IControlledProps, IIntentProps, IProps { * @default false */ var disabled: Boolean? + /** * Whether the component should take up the full width of its container. */ var fill: Boolean? + /** Ref handler that receives HTML `<input>` element backing this component. */ var inputRef: ((ref: HTMLInputElement?) -> Any)? + /** * Name of a Blueprint UI icon (or an icon element) to render on the left side of the input group, * before the user's cursor. */ var leftIcon: IconName? + /** Whether this input should use large styles. */ var large: Boolean? + /** Whether this input should use small styles. */ var small: Boolean? + /** Placeholder text in the absence of any value. */ var placeholder: String? + /** * Element to render on right side of input. * For best results, use a minimal button, tag, or small spinner. */ var rightElement: ReactElement? + /** Whether the input (and any buttons) should appear with rounded caps. */ var round: Boolean? + /** * HTML `input` type attribute. * @default "text" diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt index f6ca7aec..7bc4fa0d 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import react.PureComponent diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt index 254b5bb3..7c2f3c43 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.HTMLElement @@ -14,11 +15,13 @@ external interface IOverlayableProps : IOverlayLifecycleProps { * @default true */ var autoFocus: Boolean? + /** * Whether pressing the `esc` key should invoke `onClose`. * @default true */ var canEscapeKeyClose: Boolean? + /** * Whether the overlay should prevent focus from leaving itself. That is, if the user attempts * to focus an element outside the overlay and this prop is enabled, then the overlay will @@ -27,6 +30,7 @@ external interface IOverlayableProps : IOverlayLifecycleProps { * @default true */ var enforceFocus: Boolean? + /** * If `true` and `usePortal={true}`, the `Portal` containing the children is created and attached * to the DOM when the overlay is opened for the first time; otherwise this happens when the @@ -35,6 +39,7 @@ external interface IOverlayableProps : IOverlayLifecycleProps { * @default true */ var lazy: Boolean? + /** * Indicates how long (in milliseconds) the overlay's enter/leave transition takes. * This is used by React `CSSTransition` to know when a transition completes and must match @@ -43,6 +48,7 @@ external interface IOverlayableProps : IOverlayLifecycleProps { * @default 300 */ var transitionDuration: Int? + /** * Whether the overlay should be wrapped in a `Portal`, which renders its contents in a new * element attached to `portalContainer` prop. @@ -56,17 +62,20 @@ external interface IOverlayableProps : IOverlayLifecycleProps { * @default true */ var usePortal: Boolean? + /** * Space-delimited string of class names applied to the `Portal` element if * `usePortal={true}`. */ var portalClassName: String? + /** * The container element into which the overlay renders its contents, when `usePortal` is `true`. * This prop is ignored if `usePortal` is `false`. * @default document.body */ var portalContainer: HTMLElement? + /** * A callback that is invoked when user interaction causes the overlay to close, such as * clicking on the overlay or pressing the `esc` key (if enabled). @@ -77,53 +86,63 @@ external interface IOverlayableProps : IOverlayLifecycleProps { */ var onClose: ((Event) -> Unit)? } + external interface IOverlayLifecycleProps { /** * Lifecycle method invoked just before the CSS _close_ transition begins on * a child. Receives the DOM element of the child being closed. */ var onClosing: ((node: HTMLElement) -> Unit)? + /** * Lifecycle method invoked just after the CSS _close_ transition ends but * before the child has been removed from the DOM. Receives the DOM element * of the child being closed. */ var onClosed: ((node: HTMLElement) -> Unit)? + /** * Lifecycle method invoked just after mounting the child in the DOM but * just before the CSS _open_ transition begins. Receives the DOM element of * the child being opened. */ var onOpening: ((node: HTMLElement) -> Unit)? + /** * Lifecycle method invoked just after the CSS _open_ transition ends. * Receives the DOM element of the child being opened. */ var onOpened: ((node: HTMLElement) -> Unit)? } + external interface IBackdropProps { /** CSS class names to apply to backdrop element. */ var backdropClassName: String? + /** HTML props for the backdrop element. */ var backdropProps: RProps? // React.HTMLProps<HTMLDivElement>? + /** * Whether clicking outside the overlay element (either on backdrop when present or on document) * should invoke `onClose`. * @default true */ var canOutsideClickClose: Boolean? + /** * Whether a container-spanning backdrop element should be rendered behind the contents. * @default true */ var hasBackdrop: Boolean? } + external interface IOverlayProps : IOverlayableProps, IBackdropProps, IProps { /** * Toggles the visibility of the overlay and its children. * This prop is required because the component is controlled. */ var isOpen: Boolean + /** * Name of the transition for internal `CSSTransition`. * Providing your own name here will require defining new CSS transition properties. @@ -131,9 +150,11 @@ external interface IOverlayProps : IOverlayableProps, IBackdropProps, IProps { */ var transitionName: String? } + external interface IOverlayState : RState { var hasEverOpened: Boolean? } + external class Overlay : PureComponent<IOverlayProps, IOverlayState> { override fun render(): ReactElement } diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt index 1c610579..57093a25 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.HTMLDivElement diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt index 7a2a04f2..a3727af9 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.events.MouseEvent @@ -12,13 +13,16 @@ external interface ITagProps : IProps, IIntentProps { * @default false */ var active: Boolean? + /** * Whether the tag should take up the full width of its container. * @default false */ var fill: Boolean? + /** Name of a Blueprint UI icon (or an icon element) to render before the children. */ var icon: IconName? + /** * Whether the tag should visually respond to user interactions. If set * to `true`, hovering over the tag will change its color and mouse cursor. @@ -28,16 +32,19 @@ external interface ITagProps : IProps, IIntentProps { * @default false */ var interactive: Boolean? + /** * Whether this tag should use large styles. * @default false */ var large: Boolean? + /** * Whether this tag should use minimal styles. * @default false */ var minimal: Boolean? + /** * Whether tag content should be allowed to occupy multiple lines. * If false, a single line of text will be truncated with an ellipsis if @@ -46,18 +53,22 @@ external interface ITagProps : IProps, IIntentProps { * @default false */ var multiline: Boolean? + /** * Callback invoked when the tag is clicked. * Recommended when `interactive` is `true`. */ var onClick: ((e: MouseEvent) -> Unit)? + /** * Click handler for remove button. * The remove button will only be rendered if this prop is defined. */ var onRemove: ((e: MouseEvent, tagProps: ITagProps) -> Unit)? + /** Name of a Blueprint UI icon (or an icon element) to render after the children. */ var rightIcon: IconName? + /** * Whether this tag should have rounded ends. * @default false diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt index 7da41fc9..8063f98e 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt @@ -1,4 +1,5 @@ @file:JsModule("@blueprintjs/core") + package com.palantir.blueprintjs import org.w3c.dom.events.Event @@ -59,26 +60,33 @@ external interface IProps : RProps { /** A space-delimited list of class names to pass along to a child element. */ var className: String? } + external interface IIntentProps { /** Visual intent color to apply to element. */ var intent: Intent? } + /** Interface for a link, with support for customizing target window. */ external interface ILinkProps { /** Link URL. */ var href: String? + /** Link target attribute. Use `"_blank"` to open in a new window. */ var target: String? } + /** Interface for a controlled input. */ external interface IControlledProps { /** Initial value of the input, for uncontrolled usage. */ var defaultValue: String? + /** Change event handler. Use `event.target.value` for new value. */ var onChange: ((Event) -> Unit)? + /** Form value of the input, for controlled usage. */ var value: String? } + /** * An interface for an option in a list, such as in a `<select>` or `RadioGroup`. * These props can be spread directly to an `<option>` or `<Radio>` element. @@ -86,8 +94,10 @@ external interface IControlledProps { external interface IOptionProps : IProps { /** Whether this option is non-interactive. */ var disabled: Boolean? + /** Label text for this option. If omitted, `value` is used as the label. */ var label: String? + /** Value of this option. */ var value: Any? // String | Number } 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 9132de58..5ad0cc7c 100644 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt +++ b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt @@ -17,7 +17,7 @@ fun RBuilder.bpIcon( title: String? = null, alt: String? = null, className: String? = null, - block: RHandler<IIconProps> = {} + block: RHandler<IIconProps> = {}, ): ReactElement = child(Icon::class) { attrs { this.icon = name @@ -40,7 +40,7 @@ fun RBuilder.bpButton( rightIcon: IconName? = null, intent: Intent = Intent.NONE, onClick: ((event: MouseEvent) -> Unit)? = {}, - block: RHandler<IButtonProps> = {} + block: RHandler<IButtonProps> = {}, ): ReactElement = child(Button::class) { attrs { this.title = title @@ -59,7 +59,7 @@ fun RBuilder.bpButton( fun RBuilder.bpButtonGroup( large: Boolean = false, minimal: Boolean = false, - block: RHandler<IButtonGroupProps> = {} + block: RHandler<IButtonGroupProps> = {}, ): ReactElement = child(ButtonGroup::class) { attrs { this.large = large @@ -72,7 +72,7 @@ fun RBuilder.bpInputGroup( large: Boolean = false, placeholder: String = "", rightElement: ReactElement? = null, - onChange: (Event) -> Unit + onChange: (Event) -> Unit, ): ReactElement = child(InputGroup::class) { attrs { this.large = large @@ -90,7 +90,7 @@ fun RBuilder.bpTag( fill: Boolean? = null, active: Boolean? = null, icon: String? = null, - block: RHandler<ITagProps> = {} + block: RHandler<ITagProps> = {}, ): ReactElement = child(Tag::class) { attrs { this.intent = intent @@ -110,7 +110,7 @@ fun RBuilder.bpNonIdealState( description: ReactElement? = null, action: ReactElement? = null, children: ReactElement? = null, - block: RHandler<INonIdealStateProps> = {} + block: RHandler<INonIdealStateProps> = {}, ): ReactElement = child(NonIdealState::class) { attrs { this.icon = icon @@ -128,7 +128,7 @@ fun RBuilder.bpNonIdealState( description: ReactElement? = null, action: ReactElement? = null, children: ReactElement? = null, - block: RHandler<INonIdealStateProps> = {} + block: RHandler<INonIdealStateProps> = {}, ): ReactElement = bpNonIdealState(icon, buildElement { h2 { +title } }, description, action, children, block) fun RBuilder.bpOverlay( @@ -140,7 +140,7 @@ fun RBuilder.bpOverlay( canEscapeKeyClose: Boolean = true, canOutsideClickClose: Boolean = true, onClose: () -> Unit = {}, - block: RHandler<IOverlayProps> = {} + block: RHandler<IOverlayProps> = {}, ): ReactElement = child(Overlay::class) { attrs { this.isOpen = isOpen @@ -167,7 +167,7 @@ fun RBuilder.bpPopover( popoverClassName: String? = null, portalClassName: String? = null, onClose: () -> Unit = {}, - block: RHandler<IPopoverProps> = {} + block: RHandler<IPopoverProps> = {}, ): ReactElement = child(Popover::class) { attrs { this.interactionKind = interactionKind @@ -189,7 +189,7 @@ fun RBuilder.bpCallout( intent: Intent? = Intent.NONE, icon: IconName? = null, title: String? = null, - block: RHandler<ICalloutProps> = {} + block: RHandler<ICalloutProps> = {}, ): ReactElement = child(Callout::class) { attrs { if (icon != null) { @@ -206,7 +206,7 @@ fun RBuilder.bpCard( interactive: Boolean = false, className: String? = null, onClick: () -> Unit = {}, - block: RHandler<ICardProps> = {} + block: RHandler<ICardProps> = {}, ): ReactElement = child(Card::class) { attrs { this.elevation = elevation @@ -222,7 +222,7 @@ fun RBuilder.bpHtmlTable( interactive: Boolean = false, condensed: Boolean = false, striped: Boolean = false, - block: RHandler<IHTMLTableProps> = {} + block: RHandler<IHTMLTableProps> = {}, ): ReactElement = child(HTMLTable::class) { attrs { this.bordered = bordered @@ -235,7 +235,7 @@ fun RBuilder.bpHtmlTable( fun RBuilder.bpDivider( tagName: String? = null, - block: RHandler<IDividerProps> = {} + block: RHandler<IDividerProps> = {}, ): ReactElement = child(Divider::class) { attrs { if (tagName != null) { |