How to use the @blueprintjs/docs-theme.createKeyEventHandler function in @blueprintjs/docs-theme

To help you get started, we’ve selected a few @blueprintjs/docs-theme examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github palantir / blueprint / packages / docs-app / src / components / clickToCopy.tsx View on Github external
value={value}
                />
                {children}
            
        );
    }

    private handleClickEvent = (e: React.SyntheticEvent) => {
        this.inputElement.select();
        document.execCommand("copy");
        this.setState({ hasCopied: true });
        Utils.safeInvoke(this.props.onClick, e);
    };

    // tslint:disable-next-line:member-ordering
    private handleKeyDown = createKeyEventHandler(
        {
            all: this.props.onKeyDown,
            [Keys.SPACE]: this.handleClickEvent,
            [Keys.ENTER]: this.handleClickEvent,
        },
        true,
    );

    private handleMouseLeave = (e: React.SyntheticEvent) => {
        this.setState({ hasCopied: false });
        Utils.safeInvoke(this.props.onMouseLeave, e);
    };
}
github palantir / blueprint / packages / docs-app / src / components / colorSchemes.tsx View on Github external
private renderPalette(palette: string[], key: number, diverging?: boolean) {
        const colors = this.generateColorPalette(palette, diverging, 5);
        const swatches = colors.map((hex: string, i: number) => (
            <div style="{{">
        ));

        const classes = classNames("docs-color-palette", {
            selected: key === this.state.activePalette,
        });
        const clickHandler = this.handlePaletteChange.bind(this, key);
        const keyDownHandler = createKeyEventHandler(
            {
                [Keys.SPACE]: clickHandler,
                [Keys.ENTER]: clickHandler,
            },
            true,
        );

        return (
            <div tabindex="{0}">
                {swatches}
            </div>
        );
    }
}</div>