This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
import { Manager, Target, Popper, Arrow } from 'react-popper' | |
import Portal from 'react-travel' | |
import outy from 'outy' | |
import matchSorter, { rankings } from 'match-sorter' | |
import Autocomplete from '../Autocomplete' | |
import Badge from '../Badge' | |
import Button from '../Button' | |
import Card from '../Card' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HighlightItems extends Component { | |
render() { | |
const { items } = this.props | |
return ( | |
<ItemGroup items={items}> | |
{({ | |
selectItem, | |
selectNextItem, | |
selectPreviousItem, | |
deselectItem, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react' | |
const ITEM_SELECTED = 'ITEM_SELECTED' | |
const ITEM_DESELECTED = 'ITEM_DESELECTED' | |
class Controller extends Component { | |
static contextTypes = { | |
itemLists: PropTypes.object, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { readdirSync, readFileSync, writeFileSync } = require('fs') | |
const { resolve } = require('path') | |
const del = require('del') | |
const svgson = require('svgson') | |
const SketchTool = require('sketch-tool') | |
const IN_PATH = resolve(__dirname, 'icons.sketch') | |
const OUT_PATH = resolve(__dirname, '../packages/icons.js') | |
const Sketch = new SketchTool({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function firstDefined(...args) { | |
return args.filter(a => typeof a !== 'undefined')[0] | |
} | |
function shallowEqual(a, b) { | |
return JSON.stringify(a) === JSON.stringify(b) | |
} | |
class Item extends PureComponent { | |
static displayName = 'ItemList.Item' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PureComponent, Children, cloneElement } from 'react' | |
import ReactDOM from 'react-dom' | |
const canvas = document.createElement('canvas') | |
const context = canvas.getContext('2d') | |
const fontWeight = 400 | |
const fontSize = '16px' | |
const fontFamily = 'Lato' | |
const lineHeight = '20px' | |
context.font = `${fontWeight} ${fontSize} ${fontFamily}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getClosestScrollParent(node) { | |
const rootNode = typeof document === 'undefined' ? null : document.body | |
if (node !== null && node !== rootNode) { | |
if (node.scrollHeight > node.clientHeight) { | |
return node | |
} else { | |
return getClosestScrollParent(node.parentNode) | |
} | |
} else { | |
return null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Decay, Spring } from './wobble' | |
import PanResponder from 'universal-panresponder' | |
const decay = new Decay({ velocity: 0.8 }) | |
decay.start({ | |
fromValue: 12, | |
onUpdate: value => console.log(value), | |
}) | |
// react-loco |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pad(num, size) { | |
let s = num + '' | |
while (s.length < size) s = '0' + s | |
return s | |
} | |
class NumberField extends Component { | |
// modified from: https://stackoverflow.com/questions/995183/how-to-allow-only-numeric-0-9-in-html-inputbox-using-jquery | |
handleKeyDown = e => { | |
if ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @flow | |
import { parseColor } from './utils' | |
type Props = { | |
fill: string, | |
fillOpacity: number, | |
strokeAlign: 'center' | 'inside' | 'outside', | |
strokeOpacity: number, | |
strokeWeight: number, | |
stroke: string, |