@nivo/axes
Advanced tools
Comparing version 0.71.0 to 0.72.0
@@ -8,3 +8,2 @@ 'use strict'; | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var web = require('@react-spring/web'); | ||
@@ -15,2 +14,3 @@ var core = require('@nivo/core'); | ||
var d3Format = require('d3-format'); | ||
var jsxRuntime = require('react/jsx-runtime'); | ||
var PropTypes = _interopDefault(require('prop-types')); | ||
@@ -102,3 +102,3 @@ | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -394,16 +394,19 @@ } | ||
}, [animatedProps.opacity, _onClick, value]); | ||
return React__default.createElement(web.animated.g, Object.assign({ | ||
return jsxRuntime.jsxs(web.animated.g, _objectSpread2(_objectSpread2({ | ||
transform: animatedProps.transform | ||
}, props), React__default.createElement("line", { | ||
x1: 0, | ||
x2: lineX, | ||
y1: 0, | ||
y2: lineY, | ||
style: theme.axis.ticks.line | ||
}), React__default.createElement(web.animated.text, { | ||
dominantBaseline: textBaseline, | ||
textAnchor: textAnchor, | ||
transform: animatedProps.textTransform, | ||
style: theme.axis.ticks.text | ||
}, value)); | ||
}, props), {}, { | ||
children: [jsxRuntime.jsx("line", { | ||
x1: 0, | ||
x2: lineX, | ||
y1: 0, | ||
y2: lineY, | ||
style: theme.axis.ticks.line | ||
}), jsxRuntime.jsx(web.animated.text, { | ||
dominantBaseline: textBaseline, | ||
textAnchor: textAnchor, | ||
transform: animatedProps.textTransform, | ||
style: theme.axis.ticks.text, | ||
children: value | ||
})] | ||
})); | ||
}; | ||
@@ -492,3 +495,3 @@ | ||
legendNode = React__default.createElement("text", { | ||
legendNode = jsxRuntime.jsx("text", { | ||
transform: "translate(".concat(legendX, ", ").concat(legendY, ") rotate(").concat(legendRotation, ")"), | ||
@@ -498,4 +501,5 @@ textAnchor: textAnchor, | ||
dominantBaseline: 'central' | ||
}, theme.axis.legend.text) | ||
}, legend); | ||
}, theme.axis.legend.text), | ||
children: legend | ||
}); | ||
} | ||
@@ -552,23 +556,24 @@ | ||
}); | ||
return React__default.createElement(web.animated.g, { | ||
return jsxRuntime.jsxs(web.animated.g, { | ||
transform: animatedProps.transform, | ||
"aria-hidden": ariaHidden | ||
}, transition(function (transitionProps, tick, _state, tickIndex) { | ||
return React__default.createElement(renderTick, _objectSpread2(_objectSpread2({ | ||
tickIndex: tickIndex, | ||
format: formatValue, | ||
rotate: tickRotation, | ||
textBaseline: textBaseline, | ||
textAnchor: textAlign, | ||
animatedProps: transitionProps | ||
}, tick), onClick ? { | ||
onClick: onClick | ||
} : {})); | ||
}), React__default.createElement(web.animated.line, { | ||
style: theme.axis.domain.line, | ||
x1: 0, | ||
x2: animatedProps.lineX2, | ||
y1: 0, | ||
y2: animatedProps.lineY2 | ||
}), legendNode); | ||
"aria-hidden": ariaHidden, | ||
children: [transition(function (transitionProps, tick, _state, tickIndex) { | ||
return React.createElement(renderTick, _objectSpread2(_objectSpread2({ | ||
tickIndex: tickIndex, | ||
format: formatValue, | ||
rotate: tickRotation, | ||
textBaseline: textBaseline, | ||
textAnchor: textAlign, | ||
animatedProps: transitionProps | ||
}, tick), onClick ? { | ||
onClick: onClick | ||
} : {})); | ||
}), jsxRuntime.jsx(web.animated.line, { | ||
style: theme.axis.domain.line, | ||
x1: 0, | ||
x2: animatedProps.lineX2, | ||
y1: 0, | ||
y2: animatedProps.lineY2 | ||
}), legendNode] | ||
}); | ||
}; | ||
@@ -609,18 +614,18 @@ | ||
}; | ||
return React__default.createElement(React__default.Fragment, null, positions.map(function (position) { | ||
var axis = axes[position]; | ||
if (!axis) return null; | ||
var isXAxis = position === 'top' || position === 'bottom'; | ||
var ticksPosition = position === 'top' || position === 'left' ? 'before' : 'after'; | ||
return React__default.createElement(memoizedAxis, Object.assign({ | ||
key: position | ||
}, axis, { | ||
axis: isXAxis ? 'x' : 'y', | ||
x: position === 'right' ? width : 0, | ||
y: position === 'bottom' ? height : 0, | ||
scale: isXAxis ? xScale : yScale, | ||
length: isXAxis ? width : height, | ||
ticksPosition: ticksPosition | ||
})); | ||
})); | ||
return jsxRuntime.jsx(jsxRuntime.Fragment, { | ||
children: positions.map(function (position) { | ||
var axis = axes[position]; | ||
if (!axis) return null; | ||
var isXAxis = position === 'top' || position === 'bottom'; | ||
var ticksPosition = position === 'top' || position === 'left' ? 'before' : 'after'; | ||
return jsxRuntime.jsx(memoizedAxis, _objectSpread2(_objectSpread2({}, axis), {}, { | ||
axis: isXAxis ? 'x' : 'y', | ||
x: position === 'right' ? width : 0, | ||
y: position === 'bottom' ? height : 0, | ||
scale: isXAxis ? xScale : yScale, | ||
length: isXAxis ? width : height, | ||
ticksPosition: ticksPosition | ||
}), position); | ||
}) | ||
}); | ||
}); | ||
@@ -631,3 +636,3 @@ | ||
var theme = core.useTheme(); | ||
return React__default.createElement(web.animated.line, Object.assign({}, animatedProps, theme.grid.line)); | ||
return jsxRuntime.jsx(web.animated.line, _objectSpread2(_objectSpread2({}, animatedProps), theme.grid.line)); | ||
}); | ||
@@ -688,8 +693,10 @@ | ||
}); | ||
return React__default.createElement("g", null, transition(function (animatedProps, line) { | ||
return React__default.createElement(GridLine, Object.assign({}, line, { | ||
key: line.key, | ||
animatedProps: animatedProps | ||
})); | ||
})); | ||
return jsxRuntime.jsx("g", { | ||
children: transition(function (animatedProps, line) { | ||
return React.createElement(GridLine, _objectSpread2(_objectSpread2({}, line), {}, { | ||
key: line.key, | ||
animatedProps: animatedProps | ||
})); | ||
}) | ||
}); | ||
}); | ||
@@ -724,7 +731,9 @@ | ||
}, [height, width, yScale, yValues]); | ||
return React__default.createElement(React__default.Fragment, null, xLines && React__default.createElement(GridLines, { | ||
lines: xLines | ||
}), yLines && React__default.createElement(GridLines, { | ||
lines: yLines | ||
})); | ||
return jsxRuntime.jsxs(jsxRuntime.Fragment, { | ||
children: [xLines && jsxRuntime.jsx(GridLines, { | ||
lines: xLines | ||
}), yLines && jsxRuntime.jsx(GridLines, { | ||
lines: yLines | ||
})] | ||
}); | ||
}); | ||
@@ -731,0 +740,0 @@ |
@@ -1,2 +0,2 @@ | ||
import React, { memo, useMemo } from 'react'; | ||
import { memo, useMemo, createElement } from 'react'; | ||
import { animated, useSpring, useTransition } from '@react-spring/web'; | ||
@@ -7,2 +7,3 @@ import { textPropsByEngine, useTheme, useMotionConfig, degreesToRadians } from '@nivo/core'; | ||
import { format } from 'd3-format'; | ||
import { jsxs, jsx, Fragment } from 'react/jsx-runtime'; | ||
import PropTypes from 'prop-types'; | ||
@@ -94,3 +95,3 @@ | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -386,16 +387,19 @@ } | ||
}, [animatedProps.opacity, _onClick, value]); | ||
return React.createElement(animated.g, Object.assign({ | ||
return jsxs(animated.g, _objectSpread2(_objectSpread2({ | ||
transform: animatedProps.transform | ||
}, props), React.createElement("line", { | ||
x1: 0, | ||
x2: lineX, | ||
y1: 0, | ||
y2: lineY, | ||
style: theme.axis.ticks.line | ||
}), React.createElement(animated.text, { | ||
dominantBaseline: textBaseline, | ||
textAnchor: textAnchor, | ||
transform: animatedProps.textTransform, | ||
style: theme.axis.ticks.text | ||
}, value)); | ||
}, props), {}, { | ||
children: [jsx("line", { | ||
x1: 0, | ||
x2: lineX, | ||
y1: 0, | ||
y2: lineY, | ||
style: theme.axis.ticks.line | ||
}), jsx(animated.text, { | ||
dominantBaseline: textBaseline, | ||
textAnchor: textAnchor, | ||
transform: animatedProps.textTransform, | ||
style: theme.axis.ticks.text, | ||
children: value | ||
})] | ||
})); | ||
}; | ||
@@ -484,3 +488,3 @@ | ||
legendNode = React.createElement("text", { | ||
legendNode = jsx("text", { | ||
transform: "translate(".concat(legendX, ", ").concat(legendY, ") rotate(").concat(legendRotation, ")"), | ||
@@ -490,4 +494,5 @@ textAnchor: textAnchor, | ||
dominantBaseline: 'central' | ||
}, theme.axis.legend.text) | ||
}, legend); | ||
}, theme.axis.legend.text), | ||
children: legend | ||
}); | ||
} | ||
@@ -544,23 +549,24 @@ | ||
}); | ||
return React.createElement(animated.g, { | ||
return jsxs(animated.g, { | ||
transform: animatedProps.transform, | ||
"aria-hidden": ariaHidden | ||
}, transition(function (transitionProps, tick, _state, tickIndex) { | ||
return React.createElement(renderTick, _objectSpread2(_objectSpread2({ | ||
tickIndex: tickIndex, | ||
format: formatValue, | ||
rotate: tickRotation, | ||
textBaseline: textBaseline, | ||
textAnchor: textAlign, | ||
animatedProps: transitionProps | ||
}, tick), onClick ? { | ||
onClick: onClick | ||
} : {})); | ||
}), React.createElement(animated.line, { | ||
style: theme.axis.domain.line, | ||
x1: 0, | ||
x2: animatedProps.lineX2, | ||
y1: 0, | ||
y2: animatedProps.lineY2 | ||
}), legendNode); | ||
"aria-hidden": ariaHidden, | ||
children: [transition(function (transitionProps, tick, _state, tickIndex) { | ||
return createElement(renderTick, _objectSpread2(_objectSpread2({ | ||
tickIndex: tickIndex, | ||
format: formatValue, | ||
rotate: tickRotation, | ||
textBaseline: textBaseline, | ||
textAnchor: textAlign, | ||
animatedProps: transitionProps | ||
}, tick), onClick ? { | ||
onClick: onClick | ||
} : {})); | ||
}), jsx(animated.line, { | ||
style: theme.axis.domain.line, | ||
x1: 0, | ||
x2: animatedProps.lineX2, | ||
y1: 0, | ||
y2: animatedProps.lineY2 | ||
}), legendNode] | ||
}); | ||
}; | ||
@@ -601,18 +607,18 @@ | ||
}; | ||
return React.createElement(React.Fragment, null, positions.map(function (position) { | ||
var axis = axes[position]; | ||
if (!axis) return null; | ||
var isXAxis = position === 'top' || position === 'bottom'; | ||
var ticksPosition = position === 'top' || position === 'left' ? 'before' : 'after'; | ||
return React.createElement(memoizedAxis, Object.assign({ | ||
key: position | ||
}, axis, { | ||
axis: isXAxis ? 'x' : 'y', | ||
x: position === 'right' ? width : 0, | ||
y: position === 'bottom' ? height : 0, | ||
scale: isXAxis ? xScale : yScale, | ||
length: isXAxis ? width : height, | ||
ticksPosition: ticksPosition | ||
})); | ||
})); | ||
return jsx(Fragment, { | ||
children: positions.map(function (position) { | ||
var axis = axes[position]; | ||
if (!axis) return null; | ||
var isXAxis = position === 'top' || position === 'bottom'; | ||
var ticksPosition = position === 'top' || position === 'left' ? 'before' : 'after'; | ||
return jsx(memoizedAxis, _objectSpread2(_objectSpread2({}, axis), {}, { | ||
axis: isXAxis ? 'x' : 'y', | ||
x: position === 'right' ? width : 0, | ||
y: position === 'bottom' ? height : 0, | ||
scale: isXAxis ? xScale : yScale, | ||
length: isXAxis ? width : height, | ||
ticksPosition: ticksPosition | ||
}), position); | ||
}) | ||
}); | ||
}); | ||
@@ -623,3 +629,3 @@ | ||
var theme = useTheme(); | ||
return React.createElement(animated.line, Object.assign({}, animatedProps, theme.grid.line)); | ||
return jsx(animated.line, _objectSpread2(_objectSpread2({}, animatedProps), theme.grid.line)); | ||
}); | ||
@@ -680,8 +686,10 @@ | ||
}); | ||
return React.createElement("g", null, transition(function (animatedProps, line) { | ||
return React.createElement(GridLine, Object.assign({}, line, { | ||
key: line.key, | ||
animatedProps: animatedProps | ||
})); | ||
})); | ||
return jsx("g", { | ||
children: transition(function (animatedProps, line) { | ||
return createElement(GridLine, _objectSpread2(_objectSpread2({}, line), {}, { | ||
key: line.key, | ||
animatedProps: animatedProps | ||
})); | ||
}) | ||
}); | ||
}); | ||
@@ -716,7 +724,9 @@ | ||
}, [height, width, yScale, yValues]); | ||
return React.createElement(React.Fragment, null, xLines && React.createElement(GridLines, { | ||
lines: xLines | ||
}), yLines && React.createElement(GridLines, { | ||
lines: yLines | ||
})); | ||
return jsxs(Fragment, { | ||
children: [xLines && jsx(GridLines, { | ||
lines: xLines | ||
}), yLines && jsx(GridLines, { | ||
lines: yLines | ||
})] | ||
}); | ||
}); | ||
@@ -723,0 +733,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@react-spring/web'), require('@nivo/core'), require('d3-time'), require('d3-time-format'), require('d3-format'), require('prop-types')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react', '@react-spring/web', '@nivo/core', 'd3-time', 'd3-time-format', 'd3-format', 'prop-types'], factory) : | ||
(global = global || self, factory(global.nivo = global.nivo || {}, global.React, global['@react-spring/web'], global.nivo, global.d3, global.d3, global.d3, global.PropTypes)); | ||
}(this, (function (exports, React, web, core, d3Time, d3TimeFormat, d3Format, PropTypes) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@react-spring/web'), require('@nivo/core'), require('d3-time'), require('d3-time-format'), require('d3-format'), require('react/jsx-runtime'), require('prop-types')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'react', '@react-spring/web', '@nivo/core', 'd3-time', 'd3-time-format', 'd3-format', 'react/jsx-runtime', 'prop-types'], factory) : | ||
(global = global || self, factory(global.nivo = global.nivo || {}, global.React, global['@react-spring/web'], global.nivo, global.d3, global.d3, global.d3, global['react/jsx-runtime'], global.PropTypes)); | ||
}(this, (function (exports, React, web, core, d3Time, d3TimeFormat, d3Format, jsxRuntime, PropTypes) { 'use strict'; | ||
var React__default = 'default' in React ? React['default'] : React; | ||
PropTypes = PropTypes && Object.prototype.hasOwnProperty.call(PropTypes, 'default') ? PropTypes['default'] : PropTypes; | ||
@@ -94,3 +93,3 @@ | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(n); | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
@@ -386,16 +385,19 @@ } | ||
}, [animatedProps.opacity, _onClick, value]); | ||
return React__default.createElement(web.animated.g, Object.assign({ | ||
return jsxRuntime.jsxs(web.animated.g, _objectSpread2(_objectSpread2({ | ||
transform: animatedProps.transform | ||
}, props), React__default.createElement("line", { | ||
x1: 0, | ||
x2: lineX, | ||
y1: 0, | ||
y2: lineY, | ||
style: theme.axis.ticks.line | ||
}), React__default.createElement(web.animated.text, { | ||
dominantBaseline: textBaseline, | ||
textAnchor: textAnchor, | ||
transform: animatedProps.textTransform, | ||
style: theme.axis.ticks.text | ||
}, value)); | ||
}, props), {}, { | ||
children: [jsxRuntime.jsx("line", { | ||
x1: 0, | ||
x2: lineX, | ||
y1: 0, | ||
y2: lineY, | ||
style: theme.axis.ticks.line | ||
}), jsxRuntime.jsx(web.animated.text, { | ||
dominantBaseline: textBaseline, | ||
textAnchor: textAnchor, | ||
transform: animatedProps.textTransform, | ||
style: theme.axis.ticks.text, | ||
children: value | ||
})] | ||
})); | ||
}; | ||
@@ -484,3 +486,3 @@ | ||
legendNode = React__default.createElement("text", { | ||
legendNode = jsxRuntime.jsx("text", { | ||
transform: "translate(".concat(legendX, ", ").concat(legendY, ") rotate(").concat(legendRotation, ")"), | ||
@@ -490,4 +492,5 @@ textAnchor: textAnchor, | ||
dominantBaseline: 'central' | ||
}, theme.axis.legend.text) | ||
}, legend); | ||
}, theme.axis.legend.text), | ||
children: legend | ||
}); | ||
} | ||
@@ -544,23 +547,24 @@ | ||
}); | ||
return React__default.createElement(web.animated.g, { | ||
return jsxRuntime.jsxs(web.animated.g, { | ||
transform: animatedProps.transform, | ||
"aria-hidden": ariaHidden | ||
}, transition(function (transitionProps, tick, _state, tickIndex) { | ||
return React__default.createElement(renderTick, _objectSpread2(_objectSpread2({ | ||
tickIndex: tickIndex, | ||
format: formatValue, | ||
rotate: tickRotation, | ||
textBaseline: textBaseline, | ||
textAnchor: textAlign, | ||
animatedProps: transitionProps | ||
}, tick), onClick ? { | ||
onClick: onClick | ||
} : {})); | ||
}), React__default.createElement(web.animated.line, { | ||
style: theme.axis.domain.line, | ||
x1: 0, | ||
x2: animatedProps.lineX2, | ||
y1: 0, | ||
y2: animatedProps.lineY2 | ||
}), legendNode); | ||
"aria-hidden": ariaHidden, | ||
children: [transition(function (transitionProps, tick, _state, tickIndex) { | ||
return React.createElement(renderTick, _objectSpread2(_objectSpread2({ | ||
tickIndex: tickIndex, | ||
format: formatValue, | ||
rotate: tickRotation, | ||
textBaseline: textBaseline, | ||
textAnchor: textAlign, | ||
animatedProps: transitionProps | ||
}, tick), onClick ? { | ||
onClick: onClick | ||
} : {})); | ||
}), jsxRuntime.jsx(web.animated.line, { | ||
style: theme.axis.domain.line, | ||
x1: 0, | ||
x2: animatedProps.lineX2, | ||
y1: 0, | ||
y2: animatedProps.lineY2 | ||
}), legendNode] | ||
}); | ||
}; | ||
@@ -601,18 +605,18 @@ | ||
}; | ||
return React__default.createElement(React__default.Fragment, null, positions.map(function (position) { | ||
var axis = axes[position]; | ||
if (!axis) return null; | ||
var isXAxis = position === 'top' || position === 'bottom'; | ||
var ticksPosition = position === 'top' || position === 'left' ? 'before' : 'after'; | ||
return React__default.createElement(memoizedAxis, Object.assign({ | ||
key: position | ||
}, axis, { | ||
axis: isXAxis ? 'x' : 'y', | ||
x: position === 'right' ? width : 0, | ||
y: position === 'bottom' ? height : 0, | ||
scale: isXAxis ? xScale : yScale, | ||
length: isXAxis ? width : height, | ||
ticksPosition: ticksPosition | ||
})); | ||
})); | ||
return jsxRuntime.jsx(jsxRuntime.Fragment, { | ||
children: positions.map(function (position) { | ||
var axis = axes[position]; | ||
if (!axis) return null; | ||
var isXAxis = position === 'top' || position === 'bottom'; | ||
var ticksPosition = position === 'top' || position === 'left' ? 'before' : 'after'; | ||
return jsxRuntime.jsx(memoizedAxis, _objectSpread2(_objectSpread2({}, axis), {}, { | ||
axis: isXAxis ? 'x' : 'y', | ||
x: position === 'right' ? width : 0, | ||
y: position === 'bottom' ? height : 0, | ||
scale: isXAxis ? xScale : yScale, | ||
length: isXAxis ? width : height, | ||
ticksPosition: ticksPosition | ||
}), position); | ||
}) | ||
}); | ||
}); | ||
@@ -623,3 +627,3 @@ | ||
var theme = core.useTheme(); | ||
return React__default.createElement(web.animated.line, Object.assign({}, animatedProps, theme.grid.line)); | ||
return jsxRuntime.jsx(web.animated.line, _objectSpread2(_objectSpread2({}, animatedProps), theme.grid.line)); | ||
}); | ||
@@ -680,8 +684,10 @@ | ||
}); | ||
return React__default.createElement("g", null, transition(function (animatedProps, line) { | ||
return React__default.createElement(GridLine, Object.assign({}, line, { | ||
key: line.key, | ||
animatedProps: animatedProps | ||
})); | ||
})); | ||
return jsxRuntime.jsx("g", { | ||
children: transition(function (animatedProps, line) { | ||
return React.createElement(GridLine, _objectSpread2(_objectSpread2({}, line), {}, { | ||
key: line.key, | ||
animatedProps: animatedProps | ||
})); | ||
}) | ||
}); | ||
}); | ||
@@ -716,7 +722,9 @@ | ||
}, [height, width, yScale, yValues]); | ||
return React__default.createElement(React__default.Fragment, null, xLines && React__default.createElement(GridLines, { | ||
lines: xLines | ||
}), yLines && React__default.createElement(GridLines, { | ||
lines: yLines | ||
})); | ||
return jsxRuntime.jsxs(jsxRuntime.Fragment, { | ||
children: [xLines && jsxRuntime.jsx(GridLines, { | ||
lines: xLines | ||
}), yLines && jsxRuntime.jsx(GridLines, { | ||
lines: yLines | ||
})] | ||
}); | ||
}); | ||
@@ -723,0 +731,0 @@ |
import { CompleteTheme } from '@nivo/core'; | ||
import { TicksSpec, AnyScale, AxisLegendPosition, CanvasAxisProp, ValueFormatter } from './types'; | ||
export declare const renderAxisToCanvas: <Value extends import("@nivo/core").DatumValue>(ctx: CanvasRenderingContext2D, { axis, scale, x, y, length, ticksPosition, tickValues, tickSize, tickPadding, tickRotation, format: _format, legend, legendPosition, legendOffset, theme, }: { | ||
import { AxisValue, TicksSpec, AnyScale, AxisLegendPosition, CanvasAxisProp, ValueFormatter } from './types'; | ||
export declare const renderAxisToCanvas: <Value extends AxisValue>(ctx: CanvasRenderingContext2D, { axis, scale, x, y, length, ticksPosition, tickValues, tickSize, tickPadding, tickRotation, format: _format, legend, legendPosition, legendOffset, theme, }: { | ||
axis: 'x' | 'y'; | ||
@@ -10,3 +10,3 @@ scale: AnyScale; | ||
ticksPosition: 'before' | 'after'; | ||
tickValues?: string | number | Value[] | undefined; | ||
tickValues?: TicksSpec<Value> | undefined; | ||
tickSize?: number | undefined; | ||
@@ -17,7 +17,7 @@ tickPadding?: number | undefined; | ||
legend?: string | undefined; | ||
legendPosition?: "end" | "start" | "middle" | undefined; | ||
legendPosition?: AxisLegendPosition | undefined; | ||
legendOffset?: number | undefined; | ||
theme: CompleteTheme; | ||
}) => void; | ||
export declare const renderAxesToCanvas: <X extends import("@nivo/core").DatumValue, Y extends import("@nivo/core").DatumValue>(ctx: CanvasRenderingContext2D, { xScale, yScale, width, height, top, right, bottom, left, theme, }: { | ||
export declare const renderAxesToCanvas: <X extends AxisValue, Y extends AxisValue>(ctx: CanvasRenderingContext2D, { xScale, yScale, width, height, top, right, bottom, left, theme, }: { | ||
xScale: AnyScale; | ||
@@ -33,3 +33,3 @@ yScale: AnyScale; | ||
}) => void; | ||
export declare const renderGridLinesToCanvas: <Value extends import("@nivo/core").DatumValue>(ctx: CanvasRenderingContext2D, { width, height, scale, axis, values, }: { | ||
export declare const renderGridLinesToCanvas: <Value extends AxisValue>(ctx: CanvasRenderingContext2D, { width, height, scale, axis, values, }: { | ||
width: number; | ||
@@ -39,4 +39,4 @@ height: number; | ||
axis: 'x' | 'y'; | ||
values?: string | number | Value[] | undefined; | ||
values?: TicksSpec<Value> | undefined; | ||
}) => void; | ||
//# sourceMappingURL=canvas.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import React from 'react'; | ||
import { AnyScale, AxisProps } from '../types'; | ||
export declare const Axes: React.MemoExoticComponent<(<X extends import("@nivo/core").DatumValue, Y extends import("@nivo/core").DatumValue>({ xScale, yScale, width, height, top, right, bottom, left, }: { | ||
/// <reference types="react" /> | ||
import { AnyScale, AxisProps, AxisValue } from '../types'; | ||
export declare const Axes: import("react").MemoExoticComponent<(<X extends AxisValue, Y extends AxisValue>({ xScale, yScale, width, height, top, right, bottom, left, }: { | ||
xScale: AnyScale; | ||
@@ -5,0 +5,0 @@ yScale: AnyScale; |
@@ -1,4 +0,4 @@ | ||
import React from 'react'; | ||
import { AnyScale, AxisProps } from '../types'; | ||
declare const memoizedAxis: <Value extends import("@nivo/core").DatumValue>({ axis, scale, x, y, length, ticksPosition, tickValues, tickSize, tickPadding, tickRotation, format, renderTick, legend, legendPosition, legendOffset, onClick, ariaHidden, }: AxisProps<Value> & { | ||
import * as React from 'react'; | ||
import { AnyScale, AxisProps, AxisValue } from '../types'; | ||
declare const memoizedAxis: <Value extends AxisValue>({ axis, scale, x, y, length, ticksPosition, tickValues, tickSize, tickPadding, tickRotation, format, renderTick, legend, legendPosition, legendOffset, onClick, ariaHidden, }: AxisProps<Value> & { | ||
axis: 'x' | 'y'; | ||
@@ -5,0 +5,0 @@ scale: AnyScale; |
/// <reference types="react" /> | ||
import { AxisTickProps } from '../types'; | ||
declare const memoizedAxisTick: <Value extends import("@nivo/core").DatumValue>({ value: _value, format, lineX, lineY, onClick, textBaseline, textAnchor, animatedProps, }: AxisTickProps<Value>) => JSX.Element; | ||
import { AxisTickProps, AxisValue } from '../types'; | ||
declare const memoizedAxisTick: <Value extends AxisValue>({ value: _value, format, lineX, lineY, onClick, textBaseline, textAnchor, animatedProps, }: AxisTickProps<Value>) => JSX.Element; | ||
export { memoizedAxisTick as AxisTick }; | ||
//# sourceMappingURL=AxisTick.d.ts.map |
@@ -1,43 +0,11 @@ | ||
import React from 'react'; | ||
import { AnyScale, TicksSpec } from '../types'; | ||
export declare const Grid: React.MemoExoticComponent<(<X extends import("@nivo/core").DatumValue, Y extends import("@nivo/core").DatumValue>({ width, height, xScale, yScale, xValues, yValues, }: { | ||
/// <reference types="react" /> | ||
import { AnyScale, AxisValue, TicksSpec } from '../types'; | ||
export declare const Grid: import("react").MemoExoticComponent<(<X extends AxisValue, Y extends AxisValue>({ width, height, xScale, yScale, xValues, yValues, }: { | ||
width: number; | ||
height: number; | ||
xScale?: (import("d3-scale").ScaleBand<any> & { | ||
type: "band"; | ||
}) | (import("d3-scale").ScalePoint<any> & { | ||
type: "point"; | ||
}) | (import("d3-scale").ScaleLinear<any, number, never> & { | ||
type: "linear"; | ||
}) | (import("d3-scale").ScaleOrdinal<any, number, never> & { | ||
type: "ordinal"; | ||
}) | (import("d3-scale").ScaleTime<any, number, never> & { | ||
format: string; | ||
useUTC: boolean; | ||
type: "time"; | ||
}) | (import("d3-scale").ScaleSymLog<any, number, never> & { | ||
type: "symlog"; | ||
}) | (import("d3-scale").ScaleLogarithmic<any, number, never> & { | ||
type: "log"; | ||
}) | null | undefined; | ||
xValues?: string | number | X[] | undefined; | ||
yScale?: (import("d3-scale").ScaleBand<any> & { | ||
type: "band"; | ||
}) | (import("d3-scale").ScalePoint<any> & { | ||
type: "point"; | ||
}) | (import("d3-scale").ScaleLinear<any, number, never> & { | ||
type: "linear"; | ||
}) | (import("d3-scale").ScaleOrdinal<any, number, never> & { | ||
type: "ordinal"; | ||
}) | (import("d3-scale").ScaleTime<any, number, never> & { | ||
format: string; | ||
useUTC: boolean; | ||
type: "time"; | ||
}) | (import("d3-scale").ScaleSymLog<any, number, never> & { | ||
type: "symlog"; | ||
}) | (import("d3-scale").ScaleLogarithmic<any, number, never> & { | ||
type: "log"; | ||
}) | null | undefined; | ||
yValues?: string | number | Y[] | undefined; | ||
xScale?: AnyScale | null | undefined; | ||
xValues?: TicksSpec<X> | undefined; | ||
yScale?: AnyScale | null | undefined; | ||
yValues?: TicksSpec<Y> | undefined; | ||
}) => JSX.Element)>; | ||
//# sourceMappingURL=Grid.d.ts.map |
@@ -1,4 +0,4 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import { SpringValues } from '@react-spring/web'; | ||
export declare const GridLine: React.MemoExoticComponent<({ animatedProps, }: { | ||
export declare const GridLine: import("react").MemoExoticComponent<({ animatedProps, }: { | ||
animatedProps: SpringValues<{ | ||
@@ -5,0 +5,0 @@ opacity: number; |
@@ -1,6 +0,6 @@ | ||
import React from 'react'; | ||
/// <reference types="react" /> | ||
import { Line } from '../types'; | ||
export declare const GridLines: React.MemoExoticComponent<({ lines }: { | ||
export declare const GridLines: import("react").MemoExoticComponent<({ lines }: { | ||
lines: Line[]; | ||
}) => JSX.Element>; | ||
//# sourceMappingURL=GridLines.d.ts.map |
@@ -1,13 +0,9 @@ | ||
import { TicksSpec, AnyScale, ScaleWithBandwidth, ValueFormatter, Line } from './types'; | ||
export declare const centerScale: <Value>(scale: ScaleWithBandwidth) => (import("d3-scale").ScaleBand<any> & { | ||
type: "band"; | ||
}) | (import("d3-scale").ScalePoint<any> & { | ||
type: "point"; | ||
}) | (<T extends Value>(d: T) => number); | ||
export declare const getScaleTicks: <Value extends import("@nivo/core").DatumValue>(scale: AnyScale, spec?: string | number | Value[] | undefined) => any[]; | ||
export declare const computeCartesianTicks: <Value extends import("@nivo/core").DatumValue>({ axis, scale, ticksPosition, tickValues, tickSize, tickPadding, tickRotation, engine, }: { | ||
import { AxisValue, TicksSpec, AnyScale, ScaleWithBandwidth, ValueFormatter, Line } from './types'; | ||
export declare const centerScale: <Value>(scale: ScaleWithBandwidth) => ScaleWithBandwidth | (<T extends Value>(d: T) => number); | ||
export declare const getScaleTicks: <Value extends AxisValue>(scale: AnyScale, spec?: TicksSpec<Value> | undefined) => any[]; | ||
export declare const computeCartesianTicks: <Value extends AxisValue>({ axis, scale, ticksPosition, tickValues, tickSize, tickPadding, tickRotation, engine, }: { | ||
axis: 'x' | 'y'; | ||
scale: AnyScale; | ||
ticksPosition?: "after" | "before" | undefined; | ||
tickValues?: string | number | Value[] | undefined; | ||
tickValues?: TicksSpec<Value> | undefined; | ||
tickSize: number; | ||
@@ -25,3 +21,3 @@ tickPadding: number; | ||
y: number; | ||
key: import("csstype").AnimationIterationCountProperty; | ||
key: string | number; | ||
value: any; | ||
@@ -32,4 +28,4 @@ }[]; | ||
}; | ||
export declare const getFormatter: <Value extends import("@nivo/core").DatumValue>(format: string | ValueFormatter<Value> | undefined, scale: AnyScale) => ValueFormatter<Value> | undefined; | ||
export declare const computeGridLines: <Value extends import("@nivo/core").DatumValue>({ width, height, scale, axis, values: _values, }: { | ||
export declare const getFormatter: <Value extends AxisValue>(format: string | ValueFormatter<Value> | undefined, scale: AnyScale) => ValueFormatter<Value> | undefined; | ||
export declare const computeGridLines: <Value extends AxisValue>({ width, height, scale, axis, values: _values, }: { | ||
width: number; | ||
@@ -39,4 +35,4 @@ height: number; | ||
axis: 'x' | 'y'; | ||
values?: string | number | Value[] | undefined; | ||
values?: TicksSpec<Value> | undefined; | ||
}) => Line[]; | ||
//# sourceMappingURL=compute.d.ts.map |
@@ -0,4 +1,4 @@ | ||
import * as React from 'react'; | ||
import { Scale, ScaleBand, ScalePoint } from '@nivo/scales'; | ||
import { SpringValues } from '@react-spring/web'; | ||
import { ScaleBand, ScaleLinear, ScaleOrdinal, ScalePoint, ScaleTime, ScaleSymLog, ScaleLogarithmic } from 'd3-scale'; | ||
import React from 'react'; | ||
export declare type AxisValue = string | number | Date; | ||
@@ -11,20 +11,4 @@ export declare type GridValuesBuilder<T> = T extends number ? number[] : T extends string ? string[] : T extends Date ? Date[] : never; | ||
}; | ||
export declare type ScaleWithBandwidth = (ScaleBand<any> & { | ||
type: 'band'; | ||
}) | (ScalePoint<any> & { | ||
type: 'point'; | ||
}); | ||
export declare type AnyScale = (ScaleLinear<any, number> & { | ||
type: 'linear'; | ||
}) | (ScaleOrdinal<any, number> & { | ||
type: 'ordinal'; | ||
}) | (ScaleTime<any, number> & { | ||
format: string; | ||
useUTC: boolean; | ||
type: 'time'; | ||
}) | (ScaleSymLog<any, number> & { | ||
type: 'symlog'; | ||
}) | (ScaleLogarithmic<any, number> & { | ||
type: 'log'; | ||
}) | ScaleWithBandwidth; | ||
export declare type ScaleWithBandwidth = ScaleBand<any> | ScalePoint<any>; | ||
export declare type AnyScale = Scale<any, any>; | ||
export declare type TicksSpec<Value extends AxisValue> = number | string | Value[]; | ||
@@ -31,0 +15,0 @@ export declare type AxisLegendPosition = 'start' | 'middle' | 'end'; |
{ | ||
"name": "@nivo/axes", | ||
"version": "0.71.0", | ||
"version": "0.72.0", | ||
"license": "MIT", | ||
@@ -30,3 +30,3 @@ "author": { | ||
"dependencies": { | ||
"@nivo/scales": "0.71.0", | ||
"@nivo/scales": "0.72.0", | ||
"@react-spring/web": "9.2.0", | ||
@@ -38,3 +38,3 @@ "d3-format": "^1.4.4", | ||
"devDependencies": { | ||
"@nivo/core": "0.71.0", | ||
"@nivo/core": "0.72.0", | ||
"@types/d3-format": "^1.4.1", | ||
@@ -45,3 +45,3 @@ "@types/d3-time": "^1.1.1", | ||
"peerDependencies": { | ||
"@nivo/core": "0.71.0", | ||
"@nivo/core": "0.72.0", | ||
"prop-types": ">= 15.5.10 < 16.0.0", | ||
@@ -53,3 +53,3 @@ "react": ">= 16.8.4 < 18.0.0" | ||
}, | ||
"gitHead": "232b613bd61d2b8e5c783f4181b2d14580e2fd27" | ||
"gitHead": "26098f6437cd8ab2be166bbc52973dcbb5ee7569" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
305583
2752
+ Added@nivo/core@0.72.0(transitive)
+ Added@nivo/recompose@0.72.0(transitive)
+ Added@nivo/scales@0.72.0(transitive)
+ Added@nivo/tooltip@0.72.0(transitive)
- Removed@nivo/core@0.71.0(transitive)
- Removed@nivo/recompose@0.71.0(transitive)
- Removed@nivo/scales@0.71.0(transitive)
- Removed@nivo/tooltip@0.71.0(transitive)
Updated@nivo/scales@0.72.0