diff options
Diffstat (limited to 'sw-ui/src')
31 files changed, 61 insertions, 1619 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 deleted file mode 100644 index 7438e0ba..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpButtons.kt +++ /dev/null @@ -1,135 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import org.w3c.dom.HTMLElement -import org.w3c.dom.events.MouseEvent -import react.PureComponent -import react.RState -import react.ReactElement - -/** - * Interface for a clickable action, such as a button or menu item. - * These props can be spready directly to a `<Button>` or `<MenuItem>` element. - */ -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? -} - -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 - * text to that side and push `icon` and `rightIcon` to either edge. Passing - * `"center"` will center the text and icons together. - * @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`. - * @default "button" - */ - var type: String? // "submit" | "reset" | "button"; -} - -external interface IButtonState : RState { - var isActive: Boolean -} - -abstract external class AbstractButton : PureComponent<IButtonProps, IButtonState> - -external class Button : AbstractButton { - override fun render(): ReactElement -} - -external class AnchorButton : AbstractButton { - override fun render(): ReactElement -} - -external interface IButtonGroupProps : IProps { - /** - * Text alignment within button. By default, icons and text will be centered - * within the button. Passing `"left"` or `"right"` will align the button - * text to that side and push `icon` and `rightIcon` to either edge. Passing - * `"center"` will center the text and icons together. - */ - var alignText: Alignment? - - /** - * Whether the button group should take up the full width of its container. - * @default false - */ - var fill: Boolean? - - /** - * Whether the child buttons should appear with minimal styling. - * @default false - */ - var minimal: Boolean? - - /** - * Whether the child buttons should appear with large styling. - * @default false - */ - var large: Boolean? - - /** - * Whether the button group should appear with vertical styling. - * @default false - */ - var vertical: Boolean? -} - -external class ButtonGroup : PureComponent<IButtonGroupProps, RState> { - 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 deleted file mode 100644 index 15d8a3f9..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCallout.kt +++ /dev/null @@ -1,27 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState - -external interface ICalloutProps : IIntentProps, IProps { - var icon: dynamic /* IconName | MaybeElement */ - get() = definedExternally - set(value) = definedExternally - override var intent: Intent? - get() = definedExternally - set(value) = definedExternally - var title: String? - get() = definedExternally - set(value) = definedExternally -} - -open external class Callout : PureComponent<ICalloutProps, RState> { - override fun render(): react.ReactElement - open var getIconName: Any - - companion object { - var displayName: String - } -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt deleted file mode 100644 index be9977ec..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpCard.kt +++ /dev/null @@ -1,29 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import org.w3c.dom.events.MouseEvent -import react.PureComponent -import react.RState -import react.ReactElement - -external interface ICardProps : IProps { - var elevation: Elevation? - get() = definedExternally - set(value) = definedExternally - var interactive: Boolean? - get() = definedExternally - set(value) = definedExternally - var onClick: ((e: MouseEvent) -> Unit)? - get() = definedExternally - set(value) = definedExternally -} - -open external class Card : PureComponent<ICardProps, RState> { - override fun render(): ReactElement - - companion object { - var displayName: String - var defaultProps: ICardProps - } -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDialog.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDialog.kt deleted file mode 100644 index 1db018dd..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDialog.kt +++ /dev/null @@ -1,46 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.ReactElement - -external interface IDialogProps : 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 a Blueprint UI icon (or an icon element) to render in the - * dialog's header. Note that the header will only be rendered if `title` is - * provided. - */ - var icon: dynamic /* IconName? | ReactElement? */ - /** - * Whether to show the close button in the dialog's header. - * Note that the header will only be rendered if `title` is provided. - * @default true - */ - var isCloseButtonShown: Boolean? - /** - * CSS styles to apply to the dialog. - * @default {} - */ - var style: dynamic - /** - * Title of the dialog. If provided, an element with `Classes.DIALOG_HEADER` - * will be rendered inside the dialog before any children elements. - */ - var title: ReactElement? - /** - * Name of the transition for internal `CSSTransition`. Providing your own - * name here will require defining new CSS transition properties. - */ - var transitionName: String? -} - -external class Dialog : PureComponent<IDialogProps, RState> { - override fun render(): ReactElement -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt deleted file mode 100644 index 84f5ae31..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpDivider.kt +++ /dev/null @@ -1,21 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.ReactElement - -external interface IDividerProps : IProps { - var tagName: Any? - get() = definedExternally - set(value) = definedExternally -} - -open external class Divider : PureComponent<IDividerProps, RState> { - override fun render(): ReactElement - - companion object { - var displayName: String - } -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt deleted file mode 100644 index b39aa98c..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpHtmlTable.kt +++ /dev/null @@ -1,27 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.ReactElement - -// in BlueprintJS, IHTMLTableProps doesn't extend IProps, and yet className works fine... -external interface IHTMLTableProps : IProps { - var bordered: Boolean? - get() = definedExternally - set(value) = definedExternally - var condensed: Boolean? - get() = definedExternally - set(value) = definedExternally - var interactive: Boolean? - get() = definedExternally - set(value) = definedExternally - var striped: Boolean? - get() = definedExternally - set(value) = definedExternally -} - -open external class HTMLTable : PureComponent<IHTMLTableProps, RState> { - override fun render(): ReactElement -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt deleted file mode 100644 index 54d6bde8..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpIcon.kt +++ /dev/null @@ -1,73 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.ReactElement - -external interface IIconProps : IIntentProps, IProps { - /** - * Color of icon. This is used as the `fill` attribute on the `<svg>` image - * so it will override any CSS `color` property, including that set by - * `intent`. If this prop is omitted, icon color is inherited from - * 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 - * be explicitly set to falsy values to render nothing. - * - * - If `null` or `undefined` or `false`, this component will render - * nothing. - * - If given an `IconName` (a string literal union of all icon names), that - * icon will be rendered as an `<svg>` with `<path>` tags. Unknown strings - * will render a blank icon to occupy space. - * - If given a `JSX.Element`, that element will be rendered and _all other - * props on this component are ignored._ This type is supported to - * simplify icon support in other Blueprint components. As a consumer, you - * should avoid using `<Icon icon={<Element />}` directly; simply render - * `<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. - * @default Icon.SIZE_STANDARD = 16 - */ - var iconSize: Int? - /** CSS style properties. */ - // var style: CSSProperties? // TODO - /** - * HTML tag to use for the rendered element. - * @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 - * aural feedback. By default, this is set to the icon's name. Pass an - * explicit falsy value to disable. - */ - var title: String? -} - -external class Icon : PureComponent<IIconProps, RState> { - - override fun render(): ReactElement? - - companion object { - val SIZE_STANDARD: Int = definedExternally - val SIZE_LARGE: Int = definedExternally - } -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt deleted file mode 100644 index 90178a9b..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpInputs.kt +++ /dev/null @@ -1,63 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import org.w3c.dom.HTMLInputElement -import react.PureComponent -import react.RState -import react.ReactElement - -external interface IInputGroupProps : IControlledProps, IIntentProps, IProps { - /** - * Whether the input is non-interactive. - * Note that `rightElement` must be disabled separately; this prop will not affect it. - * @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" - */ - var type: String? -} - -external interface IInputGroupState : RState { - var rightElementWidth: Int -} - -external class InputGroup : PureComponent<IInputGroupProps, IInputGroupState> { - override fun render(): ReactElement -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt deleted file mode 100644 index 7bc4fa0d..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpNonIdealState.kt +++ /dev/null @@ -1,34 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.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? -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt deleted file mode 100644 index 7c2f3c43..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpOverlay.kt +++ /dev/null @@ -1,160 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import org.w3c.dom.HTMLElement -import org.w3c.dom.events.Event -import react.PureComponent -import react.RProps -import react.RState -import react.ReactElement - -external interface IOverlayableProps : IOverlayLifecycleProps { - /** - * Whether the overlay should acquire application focus when it first opens. - * @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 - * immediately bring focus back to itself. If you are nesting overlay components, either disable - * this prop on the "outermost" overlays or mark the nested ones `usePortal={false}`. - * @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 - * component mounts. Lazy mounting provides noticeable performance improvements if you have lots - * of overlays at once, such as on each row of a table. - * @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 - * the duration of the animation in CSS. Only set this prop if you override Blueprint's default - * transitions with new transitions of a different length. - * @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. - * - * This prop essentially determines which element is covered by the backdrop: if `false`, - * then only its parent is covered; otherwise, the entire page is covered (because the parent - * of the `Portal` is the `<body>` itself). - * - * Set this prop to `false` on nested overlays (such as `Dialog` or `Popover`) to ensure that they - * are rendered above their parents. - * @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). - * - * Receives the event from the user's interaction, if there was an event (generally either a - * mouse or key event). Note that, since this component is controlled by the `isOpen` prop, it - * will not actually close itself until that prop becomes `false`. - */ - 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. - * @default Classes.OVERLAY - */ - 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 deleted file mode 100644 index 57093a25..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpPopover.kt +++ /dev/null @@ -1,128 +0,0 @@ -@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/BpSpinner.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpSpinner.kt deleted file mode 100644 index 5439833c..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpSpinner.kt +++ /dev/null @@ -1,38 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.ReactElement - -external interface ISpinnerProps : IProps, IIntentProps { - /** - * Width and height of the spinner in pixels. The size cannot be less than - * 10px. - * - * Constants are available for common sizes: - * - `Spinner.SIZE_SMALL = 20px` - * - `Spinner.SIZE_STANDARD = 50px` - * - `Spinner.SIZE_LARGE = 100px` - * - * @default Spinner.SIZE_STANDARD = 50 - */ - var size: Int? - /** - * HTML tag for the two wrapper elements. If rendering a `<Spinner>` inside - * an `<svg>`, change this to an SVG element like `"g"`. - * @default "div" - */ - var tagName: String? - /** - * A value between 0 and 1 (inclusive) representing how far along the operation is. - * Values below 0 or above 1 will be interpreted as 0 or 1 respectively. - * Omitting this prop will result in an "indeterminate" spinner where the head spins indefinitely. - */ - var value: Double? -} - -external class Spinner : PureComponent<ISpinnerProps, RState> { - override fun render(): ReactElement -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt deleted file mode 100644 index a3727af9..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpTag.kt +++ /dev/null @@ -1,81 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import org.w3c.dom.events.MouseEvent -import react.PureComponent -import react.RState -import react.ReactElement - -external interface ITagProps : IProps, IIntentProps { - /** - * Whether the tag should appear in an active state. - * @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. - * - * Recommended when `onClick` is also defined. - * - * @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 - * it overflows. Note that icons will be vertically centered relative to - * multiline text. - * @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 - */ - var round: Boolean? -} - -external class Tag : PureComponent<ITagProps, RState> { - override fun render(): ReactElement -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpText.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpText.kt deleted file mode 100644 index 6bf4323e..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/BpText.kt +++ /dev/null @@ -1,30 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import react.PureComponent -import react.RState -import react.ReactElement - -external interface ITextProps : IProps { - /** - * Indicates that this component should be truncated with an ellipsis if it overflows its container. - * The `title` attribute will also be added when content overflows to show the full text of the children on hover. - * @default false - */ - var ellipsize: Boolean? - /** - * HTML tag name to use for rendered element. - * @default "div" - */ - var tagName: String? -} - -external interface ITextState : RState { - var textContent: String - var isContentOverflowing: Boolean -} - -external class Text : PureComponent<ITextProps, ITextState> { - override fun render(): ReactElement -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt deleted file mode 100644 index bedf2094..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjs.kt +++ /dev/null @@ -1,331 +0,0 @@ -@file:JsModule("@blueprintjs/core") - -package com.palantir.blueprintjs - -import org.w3c.dom.events.Event -import react.RProps - -/** - * The four basic intents. - */ -// export declare const Intent: { -// NONE: "none"; -// PRIMARY: "primary"; -// SUCCESS: "success"; -// WARNING: "warning"; -// DANGER: "danger"; -// }; -// export declare type Intent = typeof Intent[keyof typeof Intent]; -external enum class Intent { - NONE, - PRIMARY, - SUCCESS, - WARNING, - DANGER -} - -/** Alignment along the horizontal axis. */ -// export declare const Alignment: { -// CENTER: "center"; -// LEFT: "left"; -// RIGHT: "right"; -// }; -// export declare type Alignment = typeof Alignment[keyof typeof Alignment]; -external enum class Alignment { - CENTER, - LEFT, - RIGHT -} - -// export declare const Elevation: { -// ZERO: 0; -// ONE: 1; -// TWO: 2; -// THREE: 3; -// FOUR: 4; -// }; -// export declare type Elevation = typeof Elevation[keyof typeof Elevation]; -external enum class Elevation { - ZERO, - ONE, - TWO, - THREE, - FOUR -} - -/** - * A shared base interface for all Blueprint component props. - */ -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. - */ -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 -} - -external class Classes { - companion object { - val ACTIVE: String = definedExternally - val ALIGN_LEFT: String = definedExternally - val ALIGN_RIGHT: String = definedExternally - val DARK: String = definedExternally - val DISABLED: String = definedExternally - val FILL: String = definedExternally - val FIXED: String = definedExternally - val FIXED_TOP: String = definedExternally - val INLINE: String = definedExternally - val INTERACTIVE: String = definedExternally - val LARGE: String = definedExternally - val LOADING: String = definedExternally - val MINIMAL: String = definedExternally - val OUTLINED: String = definedExternally - val MULTILINE: String = definedExternally - val ROUND: String = definedExternally - val SMALL: String = definedExternally - val VERTICAL: String = definedExternally - val POSITION_TOP: String = definedExternally - val POSITION_BOTTOM: String = definedExternally - val POSITION_LEFT: String = definedExternally - val POSITION_RIGHT: String = definedExternally - val ELEVATION_0: String = definedExternally - val ELEVATION_1: String = definedExternally - val ELEVATION_2: String = definedExternally - val ELEVATION_3: String = definedExternally - val ELEVATION_4: String = definedExternally - val INTENT_PRIMARY: String = definedExternally - val INTENT_SUCCESS: String = definedExternally - val INTENT_WARNING: String = definedExternally - val INTENT_DANGER: String = definedExternally - val FOCUS_DISABLED: String = definedExternally - val UI_TEXT: String = definedExternally - val RUNNING_TEXT: String = definedExternally - val MONOSPACE_TEXT: String = definedExternally - val TEXT_LARGE: String = definedExternally - val TEXT_SMALL: String = definedExternally - val TEXT_MUTED: String = definedExternally - val TEXT_DISABLED: String = definedExternally - val TEXT_OVERFLOW_ELLIPSIS: String = definedExternally - val BLOCKQUOTE: String = definedExternally - val CODE: String = definedExternally - val CODE_BLOCK: String = definedExternally - val HEADING: String = definedExternally - val LIST: String = definedExternally - val LIST_UNSTYLED: String = definedExternally - val RTL: String = definedExternally - val ALERT: String = definedExternally - val ALERT_BODY: String = definedExternally - val ALERT_CONTENTS: String = definedExternally - val ALERT_FOOTER: String = definedExternally - val BREADCRUMB: String = definedExternally - val BREADCRUMB_CURRENT: String = definedExternally - val BREADCRUMBS: String = definedExternally - val BREADCRUMBS_COLLAPSED: String = definedExternally - val BUTTON: String = definedExternally - val BUTTON_GROUP: String = definedExternally - val BUTTON_SPINNER: String = definedExternally - val BUTTON_TEXT: String = definedExternally - val CALLOUT: String = definedExternally - val CALLOUT_ICON: String = definedExternally - val CARD: String = definedExternally - val COLLAPSE: String = definedExternally - val COLLAPSE_BODY: String = definedExternally - val COLLAPSIBLE_LIST: String = definedExternally - val CONTEXT_MENU: String = definedExternally - val CONTEXT_MENU_POPOVER_TARGET: String = definedExternally - val CONTROL_GROUP: String = definedExternally - val DIALOG: String = definedExternally - val DIALOG_CONTAINER: String = definedExternally - val DIALOG_BODY: String = definedExternally - val DIALOG_CLOSE_BUTTON: String = definedExternally - val DIALOG_FOOTER: String = definedExternally - val DIALOG_FOOTER_ACTIONS: String = definedExternally - val DIALOG_HEADER: String = definedExternally - val DIALOG_STEP: String = definedExternally - val DIALOG_STEP_CONTAINER: String = definedExternally - val DIALOG_STEP_TITLE: String = definedExternally - val DIALOG_STEP_ICON: String = definedExternally - val DIVIDER: String = definedExternally - val DRAWER: String = definedExternally - val DRAWER_BODY: String = definedExternally - val DRAWER_FOOTER: String = definedExternally - val DRAWER_HEADER: String = definedExternally - val EDITABLE_TEXT: String = definedExternally - val EDITABLE_TEXT_CONTENT: String = definedExternally - val EDITABLE_TEXT_EDITING: String = definedExternally - val EDITABLE_TEXT_INPUT: String = definedExternally - val EDITABLE_TEXT_PLACEHOLDER: String = definedExternally - val FLEX_EXPANDER: String = definedExternally - val HTML_SELECT: String = definedExternally - /** @deprecated prefer `<HTMLSelect>` component */ - val SELECT: String = definedExternally - val HTML_TABLE: String = definedExternally - val HTML_TABLE_BORDERED: String = definedExternally - val HTML_TABLE_CONDENSED: String = definedExternally - val HTML_TABLE_STRIPED: String = definedExternally - val INPUT: String = definedExternally - val INPUT_GHOST: String = definedExternally - val INPUT_GROUP: String = definedExternally - val INPUT_LEFT_CONTAINER: String = definedExternally - val INPUT_ACTION: String = definedExternally - val CONTROL: String = definedExternally - val CONTROL_INDICATOR: String = definedExternally - val CONTROL_INDICATOR_CHILD: String = definedExternally - val CHECKBOX: String = definedExternally - val RADIO: String = definedExternally - val SWITCH: String = definedExternally - val SWITCH_INNER_TEXT: String = definedExternally - val FILE_INPUT: String = definedExternally - val FILE_INPUT_HAS_SELECTION: String = definedExternally - val FILE_UPLOAD_INPUT: String = definedExternally - val FILE_UPLOAD_INPUT_CUSTOM_TEXT: String = definedExternally - val KEY: String = definedExternally - val KEY_COMBO: String = definedExternally - val MODIFIER_KEY: String = definedExternally - val HOTKEY: String = definedExternally - val HOTKEY_LABEL: String = definedExternally - val HOTKEY_COLUMN: String = definedExternally - val HOTKEY_DIALOG: String = definedExternally - val LABEL: String = definedExternally - val FORM_GROUP: String = definedExternally - val FORM_CONTENT: String = definedExternally - val FORM_HELPER_TEXT: String = definedExternally - val MENU: String = definedExternally - val MENU_ITEM: String = definedExternally - val MENU_ITEM_LABEL: String = definedExternally - val MENU_SUBMENU: String = definedExternally - val MENU_DIVIDER: String = definedExternally - val MENU_HEADER: String = definedExternally - val MULTISTEP_DIALOG: String = definedExternally - val MULTISTEP_DIALOG_PANELS: String = definedExternally - val MULTISTEP_DIALOG_LEFT_PANEL: String = definedExternally - val MULTISTEP_DIALOG_RIGHT_PANEL: String = definedExternally - val MULTISTEP_DIALOG_FOOTER: String = definedExternally - val NAVBAR: String = definedExternally - val NAVBAR_GROUP: String = definedExternally - val NAVBAR_HEADING: String = definedExternally - val NAVBAR_DIVIDER: String = definedExternally - val NON_IDEAL_STATE: String = definedExternally - val NON_IDEAL_STATE_VISUAL: String = definedExternally - val NUMERIC_INPUT: String = definedExternally - val OVERFLOW_LIST: String = definedExternally - val OVERFLOW_LIST_SPACER: String = definedExternally - val OVERLAY: String = definedExternally - val OVERLAY_BACKDROP: String = definedExternally - val OVERLAY_CONTAINER: String = definedExternally - val OVERLAY_CONTENT: String = definedExternally - val OVERLAY_INLINE: String = definedExternally - val OVERLAY_OPEN: String = definedExternally - val OVERLAY_SCROLL_CONTAINER: String = definedExternally - val PANEL_STACK: String = definedExternally - val PANEL_STACK_HEADER: String = definedExternally - val PANEL_STACK_HEADER_BACK: String = definedExternally - val PANEL_STACK_VIEW: String = definedExternally - val POPOVER: String = definedExternally - val POPOVER_ARROW: String = definedExternally - val POPOVER_BACKDROP: String = definedExternally - val POPOVER_CAPTURING_DISMISS: String = definedExternally - val POPOVER_CONTENT: String = definedExternally - val POPOVER_CONTENT_SIZING: String = definedExternally - val POPOVER_DISMISS: String = definedExternally - val POPOVER_DISMISS_OVERRIDE: String = definedExternally - val POPOVER_OPEN: String = definedExternally - val POPOVER_TARGET: String = definedExternally - val POPOVER_WRAPPER: String = definedExternally - val TRANSITION_CONTAINER: String = definedExternally - val PROGRESS_BAR: String = definedExternally - val PROGRESS_METER: String = definedExternally - val PROGRESS_NO_STRIPES: String = definedExternally - val PROGRESS_NO_ANIMATION: String = definedExternally - val PORTAL: String = definedExternally - val SKELETON: String = definedExternally - val SLIDER: String = definedExternally - val SLIDER_AXIS: String = definedExternally - val SLIDER_HANDLE: String = definedExternally - val SLIDER_LABEL: String = definedExternally - val SLIDER_TRACK: String = definedExternally - val SLIDER_PROGRESS: String = definedExternally - val START: String = definedExternally - val END: String = definedExternally - val SPINNER: String = definedExternally - val SPINNER_ANIMATION: String = definedExternally - val SPINNER_HEAD: String = definedExternally - val SPINNER_NO_SPIN: String = definedExternally - val SPINNER_TRACK: String = definedExternally - val TAB: String = definedExternally - val TAB_INDICATOR: String = definedExternally - val TAB_INDICATOR_WRAPPER: String = definedExternally - val TAB_LIST: String = definedExternally - val TAB_PANEL: String = definedExternally - val TABS: String = definedExternally - val TAG: String = definedExternally - val TAG_REMOVE: String = definedExternally - val TAG_INPUT: String = definedExternally - val TAG_INPUT_ICON: String = definedExternally - val TAG_INPUT_VALUES: String = definedExternally - val TOAST: String = definedExternally - val TOAST_CONTAINER: String = definedExternally - val TOAST_MESSAGE: String = definedExternally - val TOOLTIP: String = definedExternally - val TOOLTIP_INDICATOR: String = definedExternally - val TREE: String = definedExternally - val TREE_NODE: String = definedExternally - val TREE_NODE_CARET: String = definedExternally - val TREE_NODE_CARET_CLOSED: String = definedExternally - val TREE_NODE_CARET_NONE: String = definedExternally - val TREE_NODE_CARET_OPEN: String = definedExternally - val TREE_NODE_CONTENT: String = definedExternally - val TREE_NODE_EXPANDED: String = definedExternally - val TREE_NODE_ICON: String = definedExternally - val TREE_NODE_LABEL: String = definedExternally - val TREE_NODE_LIST: String = definedExternally - val TREE_NODE_SECONDARY_LABEL: String = definedExternally - val TREE_NODE_SELECTED: String = definedExternally - val TREE_ROOT: String = definedExternally - val ICON: String = definedExternally - /** @deprecated use <Icon> components and iconName prop APIs instead */ - @Deprecated("use <Icon> components and iconName prop APIs instead") - val ICON_STANDARD: String = definedExternally - /** @deprecated use <Icon> components and iconName prop APIs instead */ - @Deprecated("use <Icon> components and iconName prop APIs instead") - val ICON_LARGE: String = definedExternally - } -} diff --git a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt b/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt deleted file mode 100644 index 721fdaca..00000000 --- a/sw-ui/src/main/kotlin/com/palantir/blueprintjs/blueprintjsHelpers.kt +++ /dev/null @@ -1,347 +0,0 @@ -package com.palantir.blueprintjs - -import org.w3c.dom.events.Event -import org.w3c.dom.events.MouseEvent -import react.RBuilder -import react.RHandler -import react.ReactElement -import react.buildElement -import react.dom.h2 - -typealias IconName = String - -fun RBuilder.bpIcon( - name: IconName, - size: Int = Icon.SIZE_STANDARD, - intent: Intent = Intent.NONE, - title: String? = null, - alt: String? = null, - className: String? = null, - block: RHandler<IIconProps> = {}, -): ReactElement = child(Icon::class) { - attrs { - this.icon = name - this.iconSize = size - this.htmlTitle = title - this.intent = intent - this.title = alt - this.className = className - } - block() -} - -fun RBuilder.bpButton( - minimal: Boolean = false, - small: Boolean = false, - large: Boolean = false, - disabled: Boolean = false, - title: String? = null, - icon: IconName? = null, - rightIcon: IconName? = null, - intent: Intent = Intent.NONE, - onClick: ((event: MouseEvent) -> Unit)? = {}, - block: RHandler<IButtonProps> = {}, -): ReactElement = child(Button::class) { - attrs { - this.title = title - this.minimal = minimal - this.small = small - this.large = large - this.disabled = disabled - this.icon = icon - this.rightIcon = rightIcon - this.intent = intent - this.onClick = onClick - } - block() -} - -fun RBuilder.bpButtonGroup( - large: Boolean = false, - minimal: Boolean = false, - block: RHandler<IButtonGroupProps> = {}, -): ReactElement = child(ButtonGroup::class) { - attrs { - this.large = large - this.minimal = minimal - } - block() -} - -fun RBuilder.bpInputGroup( - large: Boolean = false, - placeholder: String = "", - rightElement: ReactElement? = null, - value: String? = null, - onChange: (Event) -> Unit, -): ReactElement = child(InputGroup::class) { - attrs { - this.large = large - this.placeholder = placeholder - this.rightElement = rightElement - value?.let { this.value = it } - this.onChange = onChange - } -} - -fun RBuilder.bpTag( - intent: Intent? = null, - minimal: Boolean? = null, - large: Boolean? = null, - round: Boolean? = null, - fill: Boolean? = null, - active: Boolean? = null, - icon: String? = null, - className: String? = null, - block: RHandler<ITagProps> = {}, -): ReactElement = child(Tag::class) { - attrs { - intent?.let { this.intent = it } - minimal?.let { this.minimal = it } - large?.let { this.large = it } - round?.let { this.round = it } - fill?.let { this.fill = it } - icon?.let { this.icon = it } - active?.let { this.active = it } - className?.let { this.className = it } - } - block() -} - -fun RBuilder.bpText( - ellipsize: Boolean? = null, - tagName: String? = null, - block: RHandler<ITextProps> = {}, -): ReactElement = child(Text::class) { - attrs { - ellipsize?.let { this.ellipsize = it } - tagName?.let { this.tagName = it } - } - block() -} - -fun RBuilder.bpSpinner( - size: Int? = null, - value: Double? = null, - intent: Intent? = null, - tagName: String? = null, - block: RHandler<ISpinnerProps> = {}, -): ReactElement = child(Spinner::class) { - attrs { - size?.let { this.size = it } - value?.let { this.value = it } - intent?.let { this.intent = it } - tagName?.let { this.tagName = it } - } - 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 { - icon?.let { this.icon = it } - title?.let { this.title = it } - description?.let { this.description = it } - action?.let { this.action = it } - children?.let { this.children = it } - } - block() -} - -fun RBuilder.bpNonIdealState( - icon: IconName? = null, - title: String, - description: ReactElement? = null, - action: ReactElement? = null, - children: ReactElement? = null, - block: RHandler<INonIdealStateProps> = {}, -): ReactElement = bpNonIdealState(icon, buildElement { h2 { +title } }, description, action, children, block) - -fun RBuilder.bpOverlay( - isOpen: Boolean, - autoFocus: Boolean = true, - enforceFocus: Boolean = true, - usePortal: Boolean = true, - hasBackdrop: Boolean = true, - canEscapeKeyClose: Boolean = true, - canOutsideClickClose: Boolean = true, - onClose: () -> Unit = {}, - block: RHandler<IOverlayProps> = {}, -): ReactElement = child(Overlay::class) { - attrs { - this.isOpen = isOpen - this.autoFocus = autoFocus - this.enforceFocus = enforceFocus - this.usePortal = usePortal - this.hasBackdrop = hasBackdrop - this.canEscapeKeyClose = canEscapeKeyClose - this.canOutsideClickClose = canOutsideClickClose - this.onClose = { onClose() } - } - block() -} - -fun RBuilder.bpDialog( - isOpen: Boolean, - title: ReactElement? = null, - icon: ReactElement? = null, - autoFocus: Boolean = true, - enforceFocus: Boolean = true, - usePortal: Boolean = true, - hasBackdrop: Boolean = true, - canEscapeKeyClose: Boolean = true, - canOutsideClickClose: Boolean = true, - isCloseButtonShown: Boolean = true, - transitionName: String? = null, - onClose: () -> Unit = {}, - block: RHandler<IDialogProps> = {}, -): ReactElement = child(Dialog::class) { - attrs { - this.isOpen = isOpen - if (title != null) { - this.title = title - } - if (icon != null) { - this.icon = icon - } - this.autoFocus = autoFocus - this.enforceFocus = enforceFocus - this.usePortal = usePortal - this.hasBackdrop = hasBackdrop - this.canEscapeKeyClose = canEscapeKeyClose - this.canOutsideClickClose = canOutsideClickClose - this.isCloseButtonShown = isCloseButtonShown - if (transitionName != null) { - this.transitionName = transitionName - } - this.onClose = { onClose() } - } - block() -} - -fun RBuilder.bpDialog( - isOpen: Boolean, - title: String?, - icon: IconName? = null, - iconIntent: Intent = Intent.NONE, - autoFocus: Boolean = true, - enforceFocus: Boolean = true, - usePortal: Boolean = true, - hasBackdrop: Boolean = true, - canEscapeKeyClose: Boolean = true, - canOutsideClickClose: Boolean = true, - isCloseButtonShown: Boolean = true, - transitionName: String? = null, - onClose: () -> Unit = {}, - block: RHandler<IDialogProps> = {}, -): ReactElement = bpDialog( - isOpen = isOpen, - title = title?.let { buildElement { +title } }, - icon = icon?.let { buildElement { bpIcon(name = icon, intent = iconIntent) } }, - autoFocus = autoFocus, - enforceFocus = enforceFocus, - usePortal = usePortal, - hasBackdrop = hasBackdrop, - canEscapeKeyClose = canEscapeKeyClose, - canOutsideClickClose = canOutsideClickClose, - isCloseButtonShown = isCloseButtonShown, - transitionName = transitionName, - onClose = onClose, - block = 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, - title: String? = null, - block: RHandler<ICalloutProps> = {}, -): ReactElement = child(Callout::class) { - attrs { - if (icon != null) { - this.icon = icon - } - this.title = title - this.intent = intent - } - block() -} - -fun RBuilder.bpCard( - elevation: Elevation = Elevation.ZERO, - interactive: Boolean = false, - className: String? = null, - onClick: () -> Unit = {}, - block: RHandler<ICardProps> = {}, -): ReactElement = child(Card::class) { - attrs { - this.elevation = elevation - this.interactive = interactive - this.className = className - this.onClick = { onClick() } - } - block() -} - -fun RBuilder.bpHtmlTable( - bordered: Boolean = false, - interactive: Boolean = false, - condensed: Boolean = false, - striped: Boolean = false, - block: RHandler<IHTMLTableProps> = {}, -): ReactElement = child(HTMLTable::class) { - attrs { - this.bordered = bordered - this.interactive = interactive - this.condensed = condensed - this.striped = striped - } - block() -} - -fun RBuilder.bpDivider( - tagName: String? = null, - block: RHandler<IDividerProps> = {}, -): ReactElement = child(Divider::class) { - attrs { - if (tagName != null) { - this.tagName = tagName - } - } - block() -} diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt index cb35ef54..e74b2e75 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt @@ -1,9 +1,10 @@ package org.luxons.sevenwonders.ui.components.errors -import com.palantir.blueprintjs.Classes -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton -import com.palantir.blueprintjs.bpDialog +import blueprintjs.core.Classes +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.core.bpDialog +import blueprintjs.icons.IconNames import kotlinx.browser.window import org.luxons.sevenwonders.ui.redux.* import org.luxons.sevenwonders.ui.router.Navigate @@ -32,7 +33,7 @@ class ErrorDialogPresenter(props: ErrorDialogProps) : RComponent<ErrorDialogProp bpDialog( isOpen = errorMessage != null, title = "Oops!", - icon = "error", + icon = IconNames.ERROR, iconIntent = Intent.DANGER, onClose = { goHomeAndRefresh() } ) { @@ -48,7 +49,7 @@ class ErrorDialogPresenter(props: ErrorDialogProps) : RComponent<ErrorDialogProp css { classes.add(Classes.DIALOG_FOOTER) } - bpButton(icon = "log-out", onClick = { goHomeAndRefresh() }) { + bpButton(icon = IconNames.LOG_OUT, onClick = { goHomeAndRefresh() }) { +"HOME" } } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt index 9573c12a..57614922 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt @@ -1,8 +1,8 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.PopoverPosition -import com.palantir.blueprintjs.bpDivider -import com.palantir.blueprintjs.bpPopover +import blueprintjs.core.PopoverPosition +import blueprintjs.core.bpDivider +import blueprintjs.core.bpPopover import kotlinx.css.* import kotlinx.html.DIV import org.luxons.sevenwonders.model.api.PlayerDTO diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt index 976bb2a6..06021cea 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* +import kotlinx.css.Position import kotlinx.css.properties.transform import kotlinx.css.properties.translate import org.luxons.sevenwonders.client.GameState @@ -64,7 +66,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, Game } val game = props.game if (game == null) { - bpNonIdealState(icon = "error", title = "Error: no game data") + bpNonIdealState(icon = IconNames.ERROR, title = "Error: no game data") } else { boardScene(game) } @@ -156,7 +158,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, Game attrs { this.className = GlobalStyles.getClassName { it::noPadding } } - bpCallout(intent = Intent.PRIMARY, icon = "info-sign") { +message } + bpCallout(intent = Intent.PRIMARY, icon = IconNames.INFO_SIGN) { +message } } } } @@ -272,13 +274,13 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, Game large = true, disabled = isReady, intent = intent, - icon = if (isReady) "tick-circle" else "play", + icon = if (isReady) IconNames.TICK_CIRCLE else IconNames.PLAY, onClick = { props.sayReady() }, ) { +"READY" } // not really a button, but nice for style - bpButton(large = true, icon = "people", disabled = isReady, intent = intent) { + bpButton(large = true, icon = IconNames.PEOPLE, disabled = isReady, intent = intent) { +"${props.players.count { it.isReady }}/${props.players.size}" } } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt index 1e60dcd4..eae2bd3c 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* +import kotlinx.css.Position import kotlinx.css.properties.* import kotlinx.html.DIV import org.luxons.sevenwonders.client.GameState @@ -12,6 +14,7 @@ import org.luxons.sevenwonders.model.cards.CardPlayability import org.luxons.sevenwonders.model.cards.HandCard import org.luxons.sevenwonders.model.resources.ResourceTransactionOptions import org.luxons.sevenwonders.model.wonders.WonderBuildability +import org.w3c.dom.HTMLButtonElement import react.* import styled.StyledDOMBuilder import styled.css @@ -165,7 +168,7 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(props) { title = "DISCARD (+3 coins)", // TODO remove hardcoded value large = true, intent = Intent.DANGER, - icon = "cross", + icon = IconNames.CROSS, onClick = { props.prepareMove(PlayerMove(MoveType.DISCARD, card.name)) }, ) } @@ -192,7 +195,7 @@ private fun pricePrefix(amount: Int) = when { else -> "" } -private fun RElementBuilder<IButtonProps>.priceInfo(amount: Int) { +private fun RElementBuilder<IButtonProps<HTMLButtonElement>>.priceInfo(amount: Int) { val size = 1.rem goldIndicator( amount = amount, diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt index 9c46d2de..cba458ef 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.bpIcon +import blueprintjs.core.bpIcon import kotlinx.css.* import kotlinx.html.title import org.luxons.sevenwonders.model.cards.HandRotationDirection diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt index 1acaacdf..a56bbc00 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt @@ -1,7 +1,8 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.css.properties.* import kotlinx.html.DIV @@ -41,7 +42,7 @@ fun RBuilder.preparedMove( right = 0.px } bpButton( - icon = "cross", + icon = IconNames.CROSS, title = "Cancel prepared move", small = true, intent = Intent.DANGER, diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt index 1aa52256..a92857ae 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* import kotlinx.css.* import kotlinx.html.TD import kotlinx.html.TH diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt index 24b94748..bf850d4c 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* import kotlinx.css.* import kotlinx.html.DIV import kotlinx.html.TBODY diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt index 10adb648..1ad217e6 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt @@ -1,8 +1,9 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton -import com.palantir.blueprintjs.bpInputGroup +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.core.bpInputGroup +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.html.js.onSubmitFunction import org.luxons.sevenwonders.ui.redux.RequestCreateGame @@ -57,7 +58,7 @@ private class CreateGameForm(props: CreateGameFormProps) : RComponent<CreateGame } private fun createGameButton() = buildElement { - bpButton(minimal = true, intent = Intent.PRIMARY, icon = "add", onClick = { e -> createGame(e) }) + bpButton(minimal = true, intent = Intent.PRIMARY, icon = IconNames.ADD, onClick = { e -> createGame(e) }) } private fun createGame(e: Event) { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt index 1a38853e..ff596e53 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.Classes -import com.palantir.blueprintjs.bpCard +import blueprintjs.core.Classes +import blueprintjs.core.bpCard import kotlinx.css.* import kotlinx.html.classes import org.luxons.sevenwonders.ui.components.GlobalStyles diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt index dd93fcc9..0155835a 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt @@ -1,6 +1,7 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.html.classes import kotlinx.html.title @@ -36,7 +37,7 @@ class GameListPresenter(props: GameListProps) : RComponent<GameListProps, RState private fun RBuilder.noGamesInfo() { bpNonIdealState( - icon = "geosearch", + icon = IconNames.GEOSEARCH, title = "No games to join", ) { styledDiv { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt index cb9d1ba3..f5cc2992 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.bpIcon +import blueprintjs.core.bpIcon import kotlinx.css.* import kotlinx.html.title import org.luxons.sevenwonders.model.api.BasicPlayerInfo diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt index 800c71f0..c5764eb0 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt @@ -1,8 +1,9 @@ package org.luxons.sevenwonders.ui.components.home -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton -import com.palantir.blueprintjs.bpInputGroup +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.core.bpInputGroup +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.html.js.onSubmitFunction import org.luxons.sevenwonders.ui.redux.RequestChooseName @@ -51,7 +52,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseName private fun submitButton(): ReactElement = buildElement { bpButton( minimal = true, - icon = "arrow-right", + icon = IconNames.ARROW_RIGHT, intent = Intent.PRIMARY, onClick = { e -> chooseUsername(e) }, ) @@ -61,7 +62,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseName bpButton( title = "Generate random name", large = true, - icon = "random", + icon = IconNames.RANDOM, intent = Intent.PRIMARY, onClick = { fillRandomUsername() }, ) diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt index 12ac9dcb..5b93cdc1 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.ui.components.lobby -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* +import kotlinx.css.Position import kotlinx.css.properties.transform import kotlinx.css.properties.translate import org.luxons.sevenwonders.model.api.LobbyDTO @@ -42,7 +44,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) val currentGame = props.currentGame val currentPlayer = props.currentPlayer if (currentGame == null || currentPlayer == null) { - bpNonIdealState(icon = "error", title = "Error: no current game") + bpNonIdealState(icon = IconNames.ERROR, title = "Error: no current game") return } styledDiv { @@ -108,7 +110,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) bpButton( large = true, intent = Intent.PRIMARY, - icon = "play", + icon = IconNames.PLAY, title = startability.tooltip, disabled = !startability.canDo, onClick = { props.startGame() }, @@ -146,8 +148,8 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) private fun RBuilder.addBotButton(currentGame: LobbyDTO) { bpButton( large = true, - icon = "plus", - rightIcon = "desktop", + icon = IconNames.PLUS, + rightIcon = IconNames.DESKTOP, intent = Intent.PRIMARY, title = if (currentGame.maxPlayersReached) "Max players reached" else "Add a bot to this game", disabled = currentGame.maxPlayersReached, @@ -164,8 +166,8 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) private fun RBuilder.reorderPlayersButton(currentGame: LobbyDTO) { bpButton( - icon = "random", - rightIcon = "people", + icon = IconNames.RANDOM, + rightIcon = IconNames.PEOPLE, title = "Re-order players randomly", onClick = { reorderPlayers(currentGame) }, ) { @@ -179,7 +181,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) private fun RBuilder.randomizeWondersButton(currentGame: LobbyDTO) { bpButton( - icon = "random", + icon = IconNames.RANDOM, title = "Re-assign wonders to players randomly", onClick = { randomizeWonders(currentGame) }, ) { @@ -193,7 +195,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) } bpButtonGroup { bpButton( - icon = "random", + icon = IconNames.RANDOM, title = "Re-roll wonder sides randomly", onClick = { randomizeWonderSides(currentGame) }, ) @@ -240,7 +242,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) bpButton( large = true, intent = Intent.DANGER, - icon = "delete", + icon = IconNames.DELETE, title = "Disband the group and go back to the game browser", onClick = { props.disbandLobby() }, ) { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt index fc238956..dc40bf5d 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.ui.components.lobby -import com.palantir.blueprintjs.bpIcon -import com.palantir.blueprintjs.bpTag +import blueprintjs.core.bpIcon +import blueprintjs.core.bpTag import kotlinx.css.* import kotlinx.html.DIV import org.luxons.sevenwonders.model.api.PlayerDTO |