@spscommerce/ds-react-charts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" />
2
+ import type { ScaleConfig } from "@visx/scale";
3
+ import type { CommonProps, AxisScale } from "@visx/axis/lib/types";
4
+ import type { AxisScaleOutput } from "@visx/axis";
5
+ import type { GridProps } from "@visx/xychart/lib/components/grid/Grid";
6
+ import type { LineChartColors } from "@spscommerce/ds-shared";
7
+ import * as PropTypes from "../prop-types";
8
+ export interface LinesChartProps {
9
+ data: LineChartData[];
10
+ name: string;
11
+ color: LineChartColors;
12
+ strokeDashArray?: boolean;
13
+ }
14
+ export interface LineChartData {
15
+ x: number;
16
+ y: number;
17
+ }
18
+ declare const propTypes: {
19
+ barTooltip: PropTypes.Requireable<(props: LineTooltipProps) => JSX.Element>;
20
+ grid: PropTypes.Requireable<GridProps>;
21
+ labels: PropTypes.Validator<string[]>;
22
+ lines: PropTypes.Requireable<LinesChartProps[]>;
23
+ xAxis: PropTypes.Requireable<CommonProps<AxisScale<AxisScaleOutput>>>;
24
+ xScale: PropTypes.Validator<ScaleConfig<AxisScaleOutput, any, any>>;
25
+ yAxis: PropTypes.Requireable<CommonProps<AxisScale<AxisScaleOutput>>>;
26
+ yScale: PropTypes.Validator<ScaleConfig<AxisScaleOutput, any, any>>;
27
+ };
28
+ export interface LineTooltipProps {
29
+ yAxisName?: string;
30
+ xLineName?: string;
31
+ value?: number;
32
+ }
33
+ export declare type SpsLineChartProps = PropTypes.InferTS<typeof propTypes, HTMLDivElement>;
34
+ export declare function SpsLineChart(props: SpsLineChartProps): JSX.Element;
35
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { DSReactExamples } from "@spscommerce/ds-shared";
2
+ export declare const SpsLineChartExamples: DSReactExamples;
@@ -0,0 +1,2 @@
1
+ import type { ComponentManifest } from "@spscommerce/ds-shared";
2
+ export declare const MANIFEST: ComponentManifest;
@@ -0,0 +1,23 @@
1
+ import type { MutableRefObject } from "react";
2
+ import * as PropTypes from "prop-types";
3
+ export declare type Deprecated<T> = PropTypes.Requireable<T>;
4
+ export declare function deprecated<T>(type: PropTypes.Requireable<T>): Deprecated<T>;
5
+ export declare function enumValue<T>(e: any): PropTypes.Requireable<T>;
6
+ export declare function fun<T extends (...args: any[]) => any>(): PropTypes.Requireable<T>;
7
+ export declare function impl<T>(): PropTypes.Requireable<T>;
8
+ export declare function ref<T>(): PropTypes.Requireable<MutableRefObject<T>>;
9
+ export declare type ReactNodeOrRenderFn = PropTypes.ReactNodeLike | (() => PropTypes.ReactNodeLike);
10
+ export declare const nodeOrRenderFn: PropTypes.Requireable<ReactNodeOrRenderFn>;
11
+ export declare type TypeDoc = Record<string, string | {
12
+ type: string;
13
+ required?: boolean;
14
+ deprecated?: boolean;
15
+ }>;
16
+ export declare type InferTS<T, K extends HTMLElement> = PropTypes.InferProps<T> & Omit<React.HTMLProps<K>, keyof T>;
17
+ export declare const spsGlobalPropTypes: {
18
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
19
+ className: PropTypes.Requireable<string>;
20
+ "data-testid": PropTypes.Requireable<string>;
21
+ unsafelyReplaceClassName: PropTypes.Requireable<string>;
22
+ };
23
+ export * from "prop-types";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import type { StackedBarChartMilestone } from "@spscommerce/ds-shared";
3
+ import * as PropTypes from "../prop-types";
4
+ declare const propTypes: {
5
+ chartData: PropTypes.Requireable<ChartDataProps[]>;
6
+ chartHeight: PropTypes.Requireable<number>;
7
+ chartWidth: PropTypes.Requireable<number>;
8
+ milestones: PropTypes.Requireable<MilestonesType[]>;
9
+ useAbsoluteLegend: PropTypes.Requireable<boolean>;
10
+ barTooltip: PropTypes.Requireable<(props: BarTooltipProps) => JSX.Element>;
11
+ };
12
+ export interface ChartDataProps {
13
+ label: string;
14
+ value: number;
15
+ color: string;
16
+ }
17
+ export interface MilestonesType {
18
+ label: string;
19
+ value: number;
20
+ color: StackedBarChartMilestone;
21
+ }
22
+ export interface BarTooltipProps {
23
+ label: string;
24
+ absoluteValue: number;
25
+ relativeValue: number;
26
+ }
27
+ export declare type SpsStackedHorizontalBarChartProps = PropTypes.InferTS<typeof propTypes, HTMLDivElement>;
28
+ export declare function SpsStackedHorizontalBarChart(props: SpsStackedHorizontalBarChartProps): JSX.Element;
29
+ export {};
@@ -0,0 +1,2 @@
1
+ import type { DSReactExamples } from "@spscommerce/ds-shared";
2
+ export declare const SpsStackedHorizontalBarChartExamples: DSReactExamples;
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@spscommerce/ds-react-charts",
3
+ "description": "SPS Design System React Chart components",
4
+ "version": "0.1.0",
5
+ "author": "SPS Commerce",
6
+ "license": "UNLICENSED",
7
+ "repository": "https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-react-charts",
8
+ "homepage": "https://github.com/spscommerce/design-system/tree/master/packages/@spscommerce/ds-react-charts#readme",
9
+ "main": "./lib/index.cjs.js",
10
+ "module": "./lib/index.es.js",
11
+ "types": "./lib/index.d.ts",
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@juggle/resize-observer": "^3.3.1",
17
+ "nanoid": "^2.1.0",
18
+ "@visx/axis": "^2.1.0",
19
+ "@visx/gradient": "^2.1.0",
20
+ "@visx/grid": "^2.1.0",
21
+ "@visx/group": "^2.1.0",
22
+ "@visx/scale": "^2.1.0",
23
+ "@visx/shape": "^2.1.0",
24
+ "@visx/legend": "^2.1.0",
25
+ "@visx/xychart": "^1.7.2",
26
+ "@visx/glyph": "^2.1.2",
27
+ "react-spring": "^8.0.27"
28
+ },
29
+ "peerDependencies": {
30
+ "@spscommerce/ds-colors": "0.1.0",
31
+ "@spscommerce/ds-shared": "0.1.0",
32
+ "@spscommerce/ds-react": "0.1.0",
33
+ "@spscommerce/utils": "0.1.0",
34
+ "react": "^16.9.0"
35
+ },
36
+ "devDependencies": {
37
+ "@spscommerce/ds-colors": "0.1.0",
38
+ "@spscommerce/ds-shared": "0.1.0",
39
+ "@spscommerce/ds-react": "0.1.0",
40
+ "@spscommerce/utils": "0.1.0",
41
+ "@testing-library/jest-dom": "^4.2.4",
42
+ "@testing-library/react": "^9.3.2",
43
+ "@types/react": "^16.9.0",
44
+ "clsx": "^1.0.3",
45
+ "expect": "^24.1.0",
46
+ "react": "^16.9.0",
47
+ "typescript": "^4.4.4"
48
+ },
49
+ "scripts": {
50
+ "build": "pnpm run build:js && pnpm run build:types",
51
+ "build:js": "vite build",
52
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
53
+ "watch": "vite build --watch",
54
+ "clean": "git clean -fdX",
55
+ "pub": "pnpm pack && node ../../scripts/publish-package.js"
56
+ },
57
+ "readme": "[//]: # \"START_AUTOGENERATED\"\n\n## [@spscommerce/ds-react-charts](https://github.com/spscommerce/ui-angular/tree/master/packages/@spscommerce/ds-react-charts#readme)\n\n![release: 1.1.0](https://img.shields.io/badge/release-1.1.0-blue.svg?style=flat-square)\n![build: passing](https://img.shields.io/badge/build-passing-green.svg?style=flat-square)\n![tests: failing](https://img.shields.io/badge/tests-failing-red.svg?style=flat-square)\n\nSPS Design System React components \n \n ### Installation \n \n ```shell\nnpm install --save @spscommerce/ds-react-charts\n```\n\n#### Peer Dependencies\n\n<div class=\"row\">\n <div class=\"col-5\"> \n <table class=\"sps-table\">\n <thead class=\"sps-table__head\">\n <tr class=\"sps-table__row\">\n <th class=\"sps-table__header\">\n <span class=\"sps-table__header-cell-body\"> \n Package\n </span>\n </th>\n <th class=\"sps-table__header text-right\">\n <span class=\"sps-table__header-cell-body\"> \n Version\n </span>\n </th>\n </tr>\n </thead>\n <tbody class=\"sps-table__body\">\n <tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/ds-colors#readme\">@spscommerce/ds-colors</a></td><td class=\"sps-table__cell text-right\">^1.1.0</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://github.com/spscommerce/design-system/tree/main/packages/@spscommerce/utils#readme\">@spscommerce/utils</a></td><td class=\"sps-table__cell text-right\">^1.1.0</td></tr>\n<tr class=\"sps-table__row\"><td class=\"sps-table__cell\"><a href=\"https://reactjs.org/\">react</a></td><td class=\"sps-table__cell text-right\">^16.9.0</td></tr>\n </tbody>\n </table>\n </div>\n <div class=\"col-7\">\n &nbsp;\n </div>\n</div>\n\n[//]: # \"END_AUTOGENERATED\"\n"
58
+ }
package/vite.config.js ADDED
@@ -0,0 +1,20 @@
1
+ import path from 'path';
2
+
3
+ import { defineConfig } from 'vite';
4
+
5
+ import pkg from './package.json';
6
+
7
+ export default defineConfig({
8
+ build: {
9
+ lib: {
10
+ entry: path.resolve(__dirname, 'src/index.ts'),
11
+ formats: ['es', 'cjs'],
12
+ fileName: (format) => `index.${format}.js`,
13
+ },
14
+ outDir: path.resolve(__dirname, './lib'),
15
+ emptyOutDir: false,
16
+ rollupOptions: {
17
+ external: pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],
18
+ },
19
+ },
20
+ });