@lab49/react-order-book
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -9,2 +9,3 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
Layout["Row"] = "row"; | ||
Layout["Column"] = "column"; | ||
})(exports.Layout || (exports.Layout = {})); | ||
@@ -22,2 +23,16 @@ | ||
var defaultProps = { | ||
applyBackgroundColor: false, | ||
askColor: [235, 64, 52], | ||
bidColor: [0, 216, 101], | ||
fullOpacity: false, | ||
interpolateColor: interpolateColor, | ||
layout: exports.Layout.Column, | ||
listLength: 10, | ||
showHeaders: false, | ||
showSpread: true, | ||
spread: undefined, | ||
stylePrefix: 'rob_OrderBook' | ||
}; | ||
var renderList = function renderList(list, _ref) { | ||
@@ -61,18 +76,13 @@ var applyBackgroundColor = _ref.applyBackgroundColor, | ||
var applyBackgroundColor = _ref3.applyBackgroundColor, | ||
_ref3$askColor = _ref3.askColor, | ||
askColor = _ref3$askColor === void 0 ? [235, 64, 52] : _ref3$askColor, | ||
_ref3$bidColor = _ref3.bidColor, | ||
bidColor = _ref3$bidColor === void 0 ? [0, 216, 101] : _ref3$bidColor, | ||
askColor = _ref3.askColor, | ||
bidColor = _ref3.bidColor, | ||
book = _ref3.book, | ||
fullOpacity = _ref3.fullOpacity, | ||
_ref3$interpolateColo = _ref3.interpolateColor, | ||
interpolateColorProp = _ref3$interpolateColo === void 0 ? interpolateColor : _ref3$interpolateColo, | ||
interpolateColorProp = _ref3.interpolateColor, | ||
layout = _ref3.layout, | ||
listLength = _ref3.listLength, | ||
showHeaders = _ref3.showHeaders, | ||
_ref3$showSpread = _ref3.showSpread, | ||
showSpread = _ref3$showSpread === void 0 ? true : _ref3$showSpread, | ||
showSpread = _ref3.showSpread, | ||
rawSpread = _ref3.spread, | ||
_ref3$stylePrefix = _ref3.stylePrefix, | ||
stylePrefix = _ref3$stylePrefix === void 0 ? 'rob_OrderBook' : _ref3$stylePrefix; | ||
stylePrefix = _ref3.stylePrefix; | ||
var bids = book.bids, | ||
@@ -98,5 +108,5 @@ asks = book.asks; | ||
applyBackgroundColor: applyBackgroundColor, | ||
color: askColor, | ||
color: askColor != null ? askColor : defaultProps.askColor, | ||
fullOpacity: fullOpacity, | ||
interpolateColor: interpolateColorProp, | ||
interpolateColor: interpolateColorProp != null ? interpolateColorProp : interpolateColor, | ||
reverse: reverse, | ||
@@ -116,10 +126,11 @@ stylePrefix: stylePrefix | ||
applyBackgroundColor: applyBackgroundColor, | ||
color: bidColor, | ||
color: bidColor != null ? bidColor : defaultProps.bidColor, | ||
fullOpacity: fullOpacity, | ||
interpolateColor: interpolateColorProp, | ||
interpolateColor: interpolateColorProp != null ? interpolateColorProp : interpolateColor, | ||
stylePrefix: stylePrefix | ||
}))); | ||
}; | ||
OrderBook.defaultProps = defaultProps; | ||
exports.OrderBook = OrderBook; | ||
//# sourceMappingURL=index.js.map |
@@ -9,2 +9,3 @@ import Big from 'big.js'; | ||
Layout["Row"] = "row"; | ||
Layout["Column"] = "column"; | ||
})(Layout || (Layout = {})); | ||
@@ -22,2 +23,16 @@ | ||
var defaultProps = { | ||
applyBackgroundColor: false, | ||
askColor: [235, 64, 52], | ||
bidColor: [0, 216, 101], | ||
fullOpacity: false, | ||
interpolateColor: interpolateColor, | ||
layout: Layout.Column, | ||
listLength: 10, | ||
showHeaders: false, | ||
showSpread: true, | ||
spread: undefined, | ||
stylePrefix: 'rob_OrderBook' | ||
}; | ||
var renderList = function renderList(list, _ref) { | ||
@@ -61,18 +76,13 @@ var applyBackgroundColor = _ref.applyBackgroundColor, | ||
var applyBackgroundColor = _ref3.applyBackgroundColor, | ||
_ref3$askColor = _ref3.askColor, | ||
askColor = _ref3$askColor === void 0 ? [235, 64, 52] : _ref3$askColor, | ||
_ref3$bidColor = _ref3.bidColor, | ||
bidColor = _ref3$bidColor === void 0 ? [0, 216, 101] : _ref3$bidColor, | ||
askColor = _ref3.askColor, | ||
bidColor = _ref3.bidColor, | ||
book = _ref3.book, | ||
fullOpacity = _ref3.fullOpacity, | ||
_ref3$interpolateColo = _ref3.interpolateColor, | ||
interpolateColorProp = _ref3$interpolateColo === void 0 ? interpolateColor : _ref3$interpolateColo, | ||
interpolateColorProp = _ref3.interpolateColor, | ||
layout = _ref3.layout, | ||
listLength = _ref3.listLength, | ||
showHeaders = _ref3.showHeaders, | ||
_ref3$showSpread = _ref3.showSpread, | ||
showSpread = _ref3$showSpread === void 0 ? true : _ref3$showSpread, | ||
showSpread = _ref3.showSpread, | ||
rawSpread = _ref3.spread, | ||
_ref3$stylePrefix = _ref3.stylePrefix, | ||
stylePrefix = _ref3$stylePrefix === void 0 ? 'rob_OrderBook' : _ref3$stylePrefix; | ||
stylePrefix = _ref3.stylePrefix; | ||
var bids = book.bids, | ||
@@ -98,5 +108,5 @@ asks = book.asks; | ||
applyBackgroundColor: applyBackgroundColor, | ||
color: askColor, | ||
color: askColor != null ? askColor : defaultProps.askColor, | ||
fullOpacity: fullOpacity, | ||
interpolateColor: interpolateColorProp, | ||
interpolateColor: interpolateColorProp != null ? interpolateColorProp : interpolateColor, | ||
reverse: reverse, | ||
@@ -116,10 +126,11 @@ stylePrefix: stylePrefix | ||
applyBackgroundColor: applyBackgroundColor, | ||
color: bidColor, | ||
color: bidColor != null ? bidColor : defaultProps.bidColor, | ||
fullOpacity: fullOpacity, | ||
interpolateColor: interpolateColorProp, | ||
interpolateColor: interpolateColorProp != null ? interpolateColorProp : interpolateColor, | ||
stylePrefix: stylePrefix | ||
}))); | ||
}; | ||
OrderBook.defaultProps = defaultProps; | ||
export { Layout, OrderBook }; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
declare type PriceList = string[][]; | ||
@@ -10,3 +10,4 @@ declare type RgbColor = number[]; | ||
export declare enum Layout { | ||
Row = "row" | ||
Row = "row", | ||
Column = "column" | ||
} | ||
@@ -88,3 +89,3 @@ export interface Props { | ||
*/ | ||
export declare const OrderBook: ({ applyBackgroundColor, askColor, bidColor, book, fullOpacity, interpolateColor: interpolateColorProp, layout, listLength, showHeaders, showSpread, spread: rawSpread, stylePrefix, }: Props) => JSX.Element; | ||
export declare const OrderBook: React.FC<Props>; | ||
export {}; |
{ | ||
"name": "@lab49/react-order-book", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Render an order book for any asset class. Flexible and customizable.", | ||
@@ -30,3 +30,3 @@ "author": "brianmcallister", | ||
"build": "microbundle-crl --no-compress --format modern,cjs", | ||
"chromatic": "npx chromatic --project-token 60pcjug3hz", | ||
"chromatic": "chromatic --project-token 60pcjug3hz", | ||
"lint": "eslint --ext ts,tsx src", | ||
@@ -37,19 +37,38 @@ "prepare": "npm run build", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"test:coverage": "jest --coverage", | ||
"types": "tsc --noEmit" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/**/*.{js,ts,jsx,tsx}": [ | ||
"eslint --fix" | ||
], | ||
"*.json": [ | ||
"prettier --write" | ||
] | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.x", | ||
"big.js": "^5.x", | ||
"classnames": "^2.x" | ||
"classnames": "^2.x", | ||
"react": "^16.x" | ||
}, | ||
"jest": { | ||
"testEnvironment": "jsdom" | ||
}, | ||
"devDependencies": { | ||
"@babel/plugin-transform-runtime": "^7.15.0", | ||
"@babel/preset-env": "^7.11.0", | ||
"@babel/preset-react": "^7.10.4", | ||
"@babel/preset-typescript": "^7.10.4", | ||
"@storybook/addon-docs": "^6.0.16", | ||
"@storybook/addon-essentials": "^6.0.16", | ||
"@storybook/addon-docs": "^6.2.9", | ||
"@storybook/addon-essentials": "^6.2.9", | ||
"@storybook/addons": "^6.0.16", | ||
"@storybook/preset-create-react-app": "^3.1.4", | ||
"@storybook/preset-typescript": "^3.0.0", | ||
"@storybook/react": "^6.0.16", | ||
"@storybook/react": "^6.2.9", | ||
"@testing-library/jest-dom": "^4.2.4", | ||
@@ -64,2 +83,3 @@ "@testing-library/react": "^9.5.0", | ||
"@types/react-dom": "^16.9.7", | ||
"@types/testing-library__jest-dom": "^5.14.1", | ||
"@typescript-eslint/eslint-plugin": "^3.8.0", | ||
@@ -70,2 +90,3 @@ "@typescript-eslint/parser": "^2.34.0", | ||
"big.js": "^5.2.2", | ||
"chromatic": "^5.6.2", | ||
"classnames": "^2.2.6", | ||
@@ -83,3 +104,6 @@ "eslint": "^6.8.0", | ||
"eslint-plugin-react-hooks": "^4.0.8", | ||
"husky": "^4.3.8", | ||
"jest": "^26.4.2", | ||
"jest-environment-jsdom": "^27.5.1", | ||
"lint-staged": "^10.5.4", | ||
"microbundle-crl": "^0.13.11", | ||
@@ -86,0 +110,0 @@ "prettier": "^2.0.4", |
# @lab49/react-order-book | ||
[![codecov](https://codecov.io/gh/lab49/react-order-book/branch/master/graph/badge.svg)](https://codecov.io/gh/lab49/react-order-book) [![CircleCI](https://circleci.com/gh/lab49/react-order-book.svg?style=svg)](https://circleci.com/gh/lab49/react-order-book) [![npm version](https://img.shields.io/npm/v/@lab49/react-order-book?label=version&color=%2354C536&logo=npm)](https://www.npmjs.com/package/@lab49/react-order-book) | ||
[![codecov](https://codecov.io/gh/lab49/react-order-book/branch/master/graph/badge.svg)](https://codecov.io/gh/lab49/react-order-book) [![Node.js CI](https://github.com/lab49/react-order-book/actions/workflows/CI.yaml/badge.svg)](https://github.com/lab49/react-order-book/actions/workflows/CI.yaml) [![npm version](https://img.shields.io/npm/v/@lab49/react-order-book?label=version&color=%2354C536&logo=npm)](https://www.npmjs.com/package/@lab49/react-order-book) | ||
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md) | ||
@@ -43,3 +44,3 @@ <h3> </h3> | ||
Hosted demo: [https://react-order-book.netlify.com/](https://react-order-book.netlify.com/) | ||
Hosted demo: Hosted demo: [https://master--5f4988473b6fd20022f12dcc.chromatic.com/](https://master--5f4988473b6fd20022f12dcc.chromatic.com/) | ||
@@ -205,2 +206,3 @@ You can also run the demo locally. To get started: | ||
- [ ] Incorporate a CI process for publishing. | ||
- [ ] Add lint-staged to maintain quality. | ||
- [ ] Add a code of conduct. | ||
@@ -207,0 +209,0 @@ - [ ] Add a contributing guide. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
220
44639
48
9
336