@dfnivo/bullet
Advanced tools
Comparing version 0.79.4 to 0.79.5
@@ -16,2 +16,3 @@ "use strict"; | ||
var _hooks = require("./hooks"); | ||
var _container = require("@dfnivo/container"); | ||
function _defineProperty(obj, key, value) { | ||
@@ -83,3 +84,3 @@ if (key in obj) { | ||
}); | ||
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_core.Container, { | ||
return /*#__PURE__*/ (0, _jsxRuntime.jsx)(_container.Container, { | ||
isInteractive: isInteractive, | ||
@@ -86,0 +87,0 @@ theme: theme, |
@@ -78,3 +78,3 @@ "use strict"; | ||
var computedRanges = (0, _react.useMemo)(function() { | ||
var rangeColorScale = (0, _core.getColorScale)(rangeColors, scale, true); | ||
var rangeColorScale = (0, _core.getColorScale)(rangeColors, scale); | ||
return (0, _compute.stackValues)(ranges, scale, rangeColorScale, "range"); | ||
@@ -81,0 +81,0 @@ }, [ |
@@ -46,4 +46,4 @@ "use strict"; | ||
tooltip: _bulletTooltip.BulletTooltip, | ||
animate: _core.motionDefaultProps.animate, | ||
motionConfig: _core.motionDefaultProps.config, | ||
animate: true, | ||
motionConfig: "default", | ||
margin: _core.defaultMargin, | ||
@@ -50,0 +50,0 @@ role: "img" |
@@ -54,6 +54,7 @@ function _defineProperty(obj, key, value) { | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
import { Container, SvgWrapper, useDimensions } from "@dfnivo/core"; | ||
import { SvgWrapper, useDimensions } from "@dfnivo/core"; | ||
import { defaultProps } from "./props"; | ||
import { BulletItem } from "./BulletItem"; | ||
import { useEnhancedData } from "./hooks"; | ||
import { Container } from "@dfnivo/container"; | ||
export var Bullet = function(props) { | ||
@@ -60,0 +61,0 @@ var _$_objectSpread = _objectSpread({}, defaultProps, props), data = _$_objectSpread.data, layout = _$_objectSpread.layout, spacing = _$_objectSpread.spacing, measureSize = _$_objectSpread.measureSize, markerSize = _$_objectSpread.markerSize, reverse = _$_objectSpread.reverse, axisPosition = _$_objectSpread.axisPosition, minValue = _$_objectSpread.minValue, maxValue = _$_objectSpread.maxValue, partialMargin = _$_objectSpread.margin, width = _$_objectSpread.width, height = _$_objectSpread.height, titlePosition = _$_objectSpread.titlePosition, titleAlign = _$_objectSpread.titleAlign, titleOffsetX = _$_objectSpread.titleOffsetX, titleOffsetY = _$_objectSpread.titleOffsetY, titleRotation = _$_objectSpread.titleRotation, rangeBorderColor = _$_objectSpread.rangeBorderColor, rangeBorderWidth = _$_objectSpread.rangeBorderWidth, rangeComponent = _$_objectSpread.rangeComponent, rangeColors = _$_objectSpread.rangeColors, measureBorderColor = _$_objectSpread.measureBorderColor, measureBorderWidth = _$_objectSpread.measureBorderWidth, measureComponent = _$_objectSpread.measureComponent, measureColors = _$_objectSpread.measureColors, markerComponent = _$_objectSpread.markerComponent, markerColors = _$_objectSpread.markerColors, theme = _$_objectSpread.theme, _objectSpread_tooltip = _$_objectSpread.tooltip, tooltip = _objectSpread_tooltip === void 0 ? defaultProps.tooltip : _objectSpread_tooltip, animate = _$_objectSpread.animate, motionConfig = _$_objectSpread.motionConfig, isInteractive = _$_objectSpread.isInteractive, onRangeClick = _$_objectSpread.onRangeClick, onMeasureClick = _$_objectSpread.onMeasureClick, onMarkerClick = _$_objectSpread.onMarkerClick, role = _$_objectSpread.role; |
@@ -57,3 +57,2 @@ function _defineProperty(obj, key, value) { | ||
import { Axis } from "@dfnivo/axes"; | ||
// @ts-ignore | ||
import { getColorScale, useMotionConfig, useTheme } from "@dfnivo/core"; | ||
@@ -70,3 +69,3 @@ import { useTooltip } from "@dfnivo/tooltip"; | ||
var computedRanges = useMemo(function() { | ||
var rangeColorScale = getColorScale(rangeColors, scale, true); | ||
var rangeColorScale = getColorScale(rangeColors, scale); | ||
return stackValues(ranges, scale, rangeColorScale, "range"); | ||
@@ -73,0 +72,0 @@ }, [ |
import { BulletMarkersItem } from "./BulletMarkersItem"; | ||
import { BulletRectsItem } from "./BulletRectsItem"; | ||
import { motionDefaultProps, defaultMargin } from "@dfnivo/core"; | ||
import { defaultMargin } from "@dfnivo/core"; | ||
import { BulletTooltip } from "./BulletTooltip"; | ||
@@ -36,4 +36,4 @@ export var defaultProps = { | ||
tooltip: BulletTooltip, | ||
animate: motionDefaultProps.animate, | ||
motionConfig: motionDefaultProps.config, | ||
animate: true, | ||
motionConfig: "default", | ||
margin: defaultMargin, | ||
@@ -40,0 +40,0 @@ role: "img" |
import * as React from 'react'; | ||
import { BulletMarkersProps, ComputedMarkersDatum } from './types'; | ||
declare type MouseEventWithDatum = (datum: ComputedMarkersDatum, event: React.MouseEvent<SVGLineElement, MouseEvent>) => void; | ||
declare type EventHandlers = Record<'onMouseEnter' | 'onMouseLeave' | 'onClick', MouseEventWithDatum>; | ||
type MouseEventWithDatum = (datum: ComputedMarkersDatum, event: React.MouseEvent<SVGLineElement, MouseEvent>) => void; | ||
type EventHandlers = Record<'onMouseEnter' | 'onMouseLeave' | 'onClick', MouseEventWithDatum>; | ||
export declare const BulletMarkers: ({ scale, layout, reverse, markers, height, markerSize, component, onMouseEnter, onMouseLeave, onClick, }: BulletMarkersProps & EventHandlers) => JSX.Element; | ||
export {}; | ||
//# sourceMappingURL=BulletMarkers.d.ts.map |
import { BulletItemProps, BulletRectsProps, ComputedRangeDatum } from './types'; | ||
import { getColorScale } from '@dfnivo/core'; | ||
declare type ComputeRect = Pick<BulletRectsProps, 'layout' | 'reverse' | 'scale' | 'height'>; | ||
export declare const stackValues: (values: number[], scale: BulletItemProps['scale'], colorScale: ReturnType<getColorScale>, type: 'range' | 'measures', useAverage?: boolean) => ComputedRangeDatum[]; | ||
type ComputeRect = Pick<BulletRectsProps, 'layout' | 'reverse' | 'scale' | 'height'>; | ||
export declare const stackValues: (values: number[], scale: BulletItemProps['scale'], colorScale: ReturnType<typeof getColorScale>, type: 'range' | 'measures', useAverage?: boolean) => ComputedRangeDatum[]; | ||
export declare const getComputeRect: ({ layout, reverse, scale, height }: ComputeRect) => (d: ComputedRangeDatum) => { | ||
@@ -6,0 +6,0 @@ x: number; |
/// <reference types="react" /> | ||
import { MotionConfig } from '@dfnivo/core'; | ||
export declare const defaultProps: { | ||
@@ -34,6 +35,11 @@ readonly layout: "horizontal"; | ||
readonly animate: true; | ||
readonly motionConfig: "default"; | ||
readonly margin: import("@dfnivo/core").DefaultMargin; | ||
readonly motionConfig: MotionConfig; | ||
readonly margin: { | ||
top: number; | ||
right: number; | ||
bottom: number; | ||
left: number; | ||
}; | ||
readonly role: "img"; | ||
}; | ||
//# sourceMappingURL=props.d.ts.map |
@@ -6,8 +6,8 @@ import * as React from 'react'; | ||
import { SpringValues } from '@react-spring/web'; | ||
export declare type DatumId = string | number; | ||
export declare type DatumValue = number; | ||
export declare type WithDatumId<R> = R & { | ||
export type DatumId = string | number; | ||
export type DatumValue = number; | ||
export type WithDatumId<R> = R & { | ||
id: DatumId; | ||
}; | ||
declare type Point = { | ||
type Point = { | ||
x: number; | ||
@@ -23,3 +23,3 @@ y: number; | ||
} | ||
export declare type EnhancedDatum = Datum & { | ||
export type EnhancedDatum = Datum & { | ||
scale: ScaleLinear<number>; | ||
@@ -38,4 +38,4 @@ }; | ||
} | ||
export declare type MouseEventHandler<D, T> = (datum: D, event: React.MouseEvent<T>) => void; | ||
export declare type CommonBulletProps = Dimensions & { | ||
export type MouseEventHandler<D, T> = (datum: D, event: React.MouseEvent<T>) => void; | ||
export type CommonBulletProps = Dimensions & { | ||
margin: Box; | ||
@@ -70,3 +70,3 @@ layout: 'horizontal' | 'vertical'; | ||
}; | ||
export declare type BulletHandlers = { | ||
export type BulletHandlers = { | ||
onRangeClick?: MouseEventHandler<WithDatumId<ComputedRangeDatum>, SVGRectElement>; | ||
@@ -76,11 +76,11 @@ onMeasureClick?: MouseEventHandler<WithDatumId<ComputedRangeDatum>, SVGRectElement>; | ||
}; | ||
export declare type BulletSvgProps = Partial<CommonBulletProps> & Dimensions & BulletHandlers & ModernMotionProps & { | ||
export type BulletSvgProps = Partial<CommonBulletProps> & Dimensions & BulletHandlers & ModernMotionProps & { | ||
data: Datum[]; | ||
}; | ||
declare type MouseEventWithDatum<D, Element> = (datum: D, event: React.MouseEvent<Element, MouseEvent>) => void; | ||
export declare type BulletRectComputedRect = Point & Dimensions & { | ||
type MouseEventWithDatum<D, Element> = (datum: D, event: React.MouseEvent<Element, MouseEvent>) => void; | ||
export type BulletRectComputedRect = Point & Dimensions & { | ||
data: ComputedRangeDatum; | ||
}; | ||
export declare type BulletRectAnimatedProps = Point & Dimensions & Pick<ComputedRangeDatum, 'color'>; | ||
export declare type BulletRectsItemProps = Pick<BulletRectsProps, 'onMouseEnter' | 'onMouseLeave' | 'onClick'> & Point & Dimensions & { | ||
export type BulletRectAnimatedProps = Point & Dimensions & Pick<ComputedRangeDatum, 'color'>; | ||
export type BulletRectsItemProps = Pick<BulletRectsProps, 'onMouseEnter' | 'onMouseLeave' | 'onClick'> & Point & Dimensions & { | ||
animatedProps: SpringValues<BulletRectAnimatedProps>; | ||
@@ -94,3 +94,3 @@ borderColor: string; | ||
}; | ||
export declare type BulletMarkersItemProps = Pick<BulletMarkersProps, 'onMouseEnter' | 'onMouseLeave' | 'onClick'> & Point & { | ||
export type BulletMarkersItemProps = Pick<BulletMarkersProps, 'onMouseEnter' | 'onMouseLeave' | 'onClick'> & Point & { | ||
animatedProps: SpringValues<PositionWithColor>; | ||
@@ -107,3 +107,3 @@ size: number; | ||
}; | ||
export declare type BulletRectsProps = Pick<CommonBulletProps, 'layout' | 'reverse'> & Dimensions & Point & { | ||
export type BulletRectsProps = Pick<CommonBulletProps, 'layout' | 'reverse'> & Dimensions & Point & { | ||
animatedProps?: SpringValues<{ | ||
@@ -122,10 +122,10 @@ measuresY: number; | ||
}; | ||
export declare type Position = Point & { | ||
export type Position = Point & { | ||
size: number; | ||
rotation: number; | ||
}; | ||
export declare type MarkerWithPosition = ComputedMarkersDatum & { | ||
export type MarkerWithPosition = ComputedMarkersDatum & { | ||
position: Position; | ||
}; | ||
export declare type PositionWithColor = { | ||
export type PositionWithColor = { | ||
color: string; | ||
@@ -137,3 +137,3 @@ transform: string; | ||
}; | ||
export declare type BulletMarkersProps = Pick<CommonBulletProps, 'layout' | 'reverse'> & Pick<Dimensions, 'height'> & { | ||
export type BulletMarkersProps = Pick<CommonBulletProps, 'layout' | 'reverse'> & Pick<Dimensions, 'height'> & { | ||
scale: ScaleLinear<number>; | ||
@@ -147,3 +147,3 @@ markerSize: number; | ||
}; | ||
export declare type BulletItemProps = Omit<CommonBulletProps, 'outerWidth' | 'outerHeight' | 'margin' | 'spacing' | 'role' | 'minValue' | 'maxValue' | 'measureSize' | 'markerSize' | 'theme' | 'isInteractive'> & BulletHandlers & EnhancedDatum & ModernMotionProps & Point & { | ||
export type BulletItemProps = Omit<CommonBulletProps, 'outerWidth' | 'outerHeight' | 'margin' | 'spacing' | 'role' | 'minValue' | 'maxValue' | 'measureSize' | 'markerSize' | 'theme' | 'isInteractive'> & BulletHandlers & EnhancedDatum & ModernMotionProps & Point & { | ||
measureHeight: number; | ||
@@ -150,0 +150,0 @@ markerHeight: number; |
{ | ||
"name": "@dfnivo/bullet", | ||
"version": "0.79.4", | ||
"version": "0.79.5", | ||
"license": "MIT", | ||
@@ -32,14 +32,13 @@ "author": { | ||
"dependencies": { | ||
"@dfnivo/axes": "0.79.4", | ||
"@dfnivo/colors": "0.79.4", | ||
"@dfnivo/legends": "0.79.4", | ||
"@dfnivo/tooltip": "0.79.4", | ||
"@dfnivo/axes": "0.79.5", | ||
"@dfnivo/colors": "0.79.5", | ||
"@dfnivo/container": "0.79.5", | ||
"@dfnivo/core": "0.79.5", | ||
"@dfnivo/legends": "0.79.5", | ||
"@dfnivo/tooltip": "0.79.5", | ||
"@react-spring/web": "9.3.1" | ||
}, | ||
"devDependencies": { | ||
"@dfnivo/core": "0.79.4" | ||
}, | ||
"peerDependencies": { | ||
"@dfnivo/core": "0.79.4", | ||
"react": ">= 16.14.0 < 18.0.0" | ||
"react": ">= 16.14.0 <= 18.2.0" | ||
}, | ||
@@ -49,3 +48,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "ecf5d5d9f026d81773d1dd64e59f619c4954bd45" | ||
"gitHead": "acd92052f9f1dc0dc473f787b5d72d01df4cd4de" | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
215936
0
82
2595
0
9
+ Added@dfnivo/container@0.79.5
+ Added@dfnivo/core@0.79.5
+ Added@dfnivo/axes@0.79.5(transitive)
+ Added@dfnivo/colors@0.79.5(transitive)
+ Added@dfnivo/container@0.79.5(transitive)
+ Added@dfnivo/core@0.79.5(transitive)
+ Added@dfnivo/legends@0.79.5(transitive)
+ Added@dfnivo/recompose@0.79.5(transitive)
+ Added@dfnivo/scales@0.79.5(transitive)
+ Added@dfnivo/tooltip@0.79.5(transitive)
+ Addedlodash-es@4.17.21(transitive)
+ Addedreact@18.2.0(transitive)
- Removed@dfnivo/axes@0.79.4(transitive)
- Removed@dfnivo/colors@0.79.4(transitive)
- Removed@dfnivo/legends@0.79.4(transitive)
- Removed@dfnivo/scales@0.79.4(transitive)
Updated@dfnivo/axes@0.79.5
Updated@dfnivo/colors@0.79.5
Updated@dfnivo/legends@0.79.5
Updated@dfnivo/tooltip@0.79.5