How to use react-outside-click-handler - 4 common examples

To help you get started, we’ve selected a few react-outside-click-handler 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 meetalva / alva / packages / core / src / container / property-list / property-item-color.tsx View on Github external
import * as Components from '@meetalva/components';
import * as MobxReact from 'mobx-react';
import * as Model from '@meetalva/model';
import * as React from 'react';
import { ViewStore } from '../../store';
import { debounce } from 'lodash';

const OutsideClickHandler = require('react-outside-click-handler').default;

export interface PropertyItemColorProps {
	property: Model.ElementProperty;
}

@MobxReact.inject('store')
@MobxReact.observer
export class PropertyItemColor extends React.Component {
	private commit = debounce(() => {
		const props = this.props as PropertyItemColorProps & { store: ViewStore };
		props.store.commit();
	}, 300);

	private handleColorPickerChange = (color: { hex: string }) => {
		const { property } = this.props;
		property.setValue(color.hex);
github meetalva / alva / packages / core / src / container / property-list / action-payload-select.tsx View on Github external
import * as Components from '@meetalva/components';
import * as MobxReact from 'mobx-react';
import * as Model from '@meetalva/model';
import * as React from 'react';
import { ViewStore } from '../../store';

const OutsideClickHandler = require('react-outside-click-handler').default;

export interface ActionPayloadSelectProps {
	autoFocus?: boolean;
	placeholder?: string;
	menuIsOpen?: boolean;
	elementAction: Model.ElementAction;
	onChange?: Components.SelectProps['onChange'];
	onBlur?: React.ChangeEventHandler;
	onOutsideClick?: React.MouseEventHandler;
}

@MobxReact.inject('store')
@MobxReact.observer
export class ActionPayloadSelect extends React.Component {
	public render(): JSX.Element | null {
		const props = this.props as ActionPayloadSelectProps & { store: ViewStore };
github meetalva / alva / packages / core / src / container / property-list / reference-select.tsx View on Github external
import { ViewStore } from '../../store';
import * as uuid from 'uuid';
import * as Mobx from 'mobx';

export interface ReferenceSelectProps {
	property: Model.ElementProperty;
	iconPosition?: IconPosition;
	onDidRender?(): void;
}

export enum IconPosition {
	Default,
	Indent
}

const OutsideClickHandler = require('react-outside-click-handler').default;

const HoverReveal = styled.div`
	${Components.PropertyLinkIcon} {
		opacity: 0;
		transition: 0.3s ease-in-out opacity;
	}

	&:hover ${Components.PropertyLinkIcon} {
		opacity: 1;
	}
`;

interface PositionedLinkIconProps {
	position: IconPosition;
}
github meetalva / alva / packages / core / src / container / chrome / chrome-switch.tsx View on Github external
import * as MobxReact from 'mobx-react';
import * as React from 'react';
import * as C from '@meetalva/components';
import { ViewStore } from '../../store';
import * as Types from '@meetalva/types';
import { Check, ChevronDown } from 'react-feather';
import { When } from '../when';
const ReactSelectComponents = require('react-select').components;
const OutsideClickHandler = require('react-outside-click-handler').default;

const AppPanes = [
	Types.AppPane.PagesPane,
	Types.AppPane.ElementsPane,
	Types.AppPane.PropertiesPane
];

@MobxReact.inject('store')
@MobxReact.observer
export class ChromeSwitch extends React.Component {
	public render(): JSX.Element | null {
		const { store } = this.props as { store: ViewStore };
		const viewMode = store.getApp().getProjectViewMode();
		const isDesignView = viewMode === Types.ProjectViewMode.Design;

		const app = store.getApp();

react-outside-click-handler

A React component for dealing with clicks outside its subtree

MIT
Latest version published 5 years ago

Package Health Score

59 / 100
Full package analysis

Popular react-outside-click-handler functions

Similar packages