@wavv/ui 2.2.2-alpha.7 → 2.2.2

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.
@@ -25,7 +25,7 @@ type Props = {
25
25
  /** The width of the Y axis */
26
26
  yAxisWidth?: number;
27
27
  } & ChartProps;
28
- declare const BarChart: ({ data, legend, keys, stacked, barGap, barCategoryGap, barSize, maxBarSize, vertical, hideYLabels, hideXLabels, diagonalXLabels, maxXLabelLength, xAxisHeight, yAxisWidth, axisColor, tooltipLegendPostfix, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
28
+ declare const BarChart: ({ data, legend, keys, stacked, barGap, barCategoryGap, barSize, maxBarSize, vertical, hideYLabels, hideXLabels, diagonalXLabels, maxXLabelLength, xAxisHeight, yAxisWidth, axisColor, tooltipLegendPostfix, initialDimension, width, height, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
29
29
  export declare const DiagonalAxisTick: ({ x, y, payload, maxXLabelLength, axisColor, }: {
30
30
  x: number;
31
31
  y: number;
@@ -3,21 +3,25 @@ import { useTheme } from "@emotion/react";
3
3
  import styled from "@emotion/styled";
4
4
  import { Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, XAxis, YAxis } from "recharts";
5
5
  import { formatNumber } from "../utils/formatNumber.js";
6
- import { ChartContainer, ChartStyles, LegendContent, Tooltip } from "./ChartHelpers.js";
7
- const BarChart_BarChart = ({ data, legend, keys, stacked, barGap, barCategoryGap, barSize = 16, maxBarSize, vertical = false, hideYLabels, hideXLabels, diagonalXLabels, maxXLabelLength = 10, xAxisHeight = 22, yAxisWidth = 45, axisColor, tooltipLegendPostfix, ...rest })=>{
6
+ import { ChartContainer, ChartStyles, LegendContent, Tooltip, getInitialDimension } from "./ChartHelpers.js";
7
+ const BarChart_BarChart = ({ data, legend, keys, stacked, barGap, barCategoryGap, barSize = 16, maxBarSize, vertical = false, hideYLabels, hideXLabels, diagonalXLabels, maxXLabelLength = 10, xAxisHeight = 22, yAxisWidth = 45, axisColor, tooltipLegendPostfix, initialDimension, width, height, ...rest })=>{
8
8
  const { scale2 } = useTheme();
9
9
  const xAxisTick = diagonalXLabels ? (args)=>DiagonalAxisTick({
10
10
  ...args,
11
11
  maxXLabelLength,
12
12
  axisColor
13
13
  }) : {};
14
+ const initial = getInitialDimension(initialDimension, width, height);
14
15
  return /*#__PURE__*/ jsxs(ChartContainer, {
16
+ width: width,
17
+ height: height,
15
18
  ...rest,
16
19
  children: [
17
20
  /*#__PURE__*/ jsx(ChartStyles, {}),
18
21
  /*#__PURE__*/ jsx(ResponsiveContainer, {
19
22
  width: "100%",
20
23
  height: "100%",
24
+ initialDimension: initial,
21
25
  children: /*#__PURE__*/ jsxs(BarChart, {
22
26
  margin: {
23
27
  top: 0,
@@ -1,4 +1,4 @@
1
- import { type LegendPayload, type TooltipContentProps } from 'recharts';
1
+ import { type LegendPayload, type ResponsiveContainerProps, type TooltipContentProps } from 'recharts';
2
2
  import type { Attributes } from './typeDefs/elementTypes';
3
3
  import type { Margin, MaxWidthHeight, WidthHeight } from './types';
4
4
  type ChartData = {
@@ -23,7 +23,11 @@ export type ChartProps = {
23
23
  axisColor?: string;
24
24
  /** The postfix to display after the legend value in the tooltip */
25
25
  tooltipLegendPostfix?: React.ReactNode;
26
- } & Margin & WidthHeight & MaxWidthHeight & ElAttributes;
26
+ } & Pick<ResponsiveContainerProps, 'initialDimension'> & Margin & WidthHeight & MaxWidthHeight & ElAttributes;
27
+ type InitialDimension = ResponsiveContainerProps['initialDimension'];
28
+ type Width = WidthHeight['width'];
29
+ type Height = WidthHeight['height'];
30
+ export declare const getInitialDimension: (initialDimension: InitialDimension, width: Width, height: Height) => InitialDimension;
27
31
  export declare const ChartStyles: () => import("react/jsx-runtime").JSX.Element;
28
32
  export declare const ChartContainer: import("@emotion/styled").StyledComponent<{
29
33
  theme?: import("@emotion/react").Theme;
@@ -5,6 +5,13 @@ import { Tooltip } from "recharts";
5
5
  import { numberWithCommas } from "../utils/index.js";
6
6
  import Dot from "./Dot.js";
7
7
  import { marginProps } from "./helpers/styledProps.js";
8
+ const getInitialDimension = (initialDimension, width, height)=>{
9
+ if (initialDimension) return initialDimension;
10
+ if ('number' == typeof width && 'number' == typeof height) return {
11
+ width,
12
+ height
13
+ };
14
+ };
8
15
  const ChartStyles = ()=>/*#__PURE__*/ jsx(Global, {
9
16
  styles: {
10
17
  '.recharts-cartesian-grid-vertical line:first-of-type': {
@@ -118,4 +125,4 @@ const TooltipLabel = styled.div(({ theme })=>({
118
125
  color: theme.tooltip.color.subtext,
119
126
  marginBottom: 4
120
127
  }));
121
- export { ChartContainer, ChartStyles, LegendContent, ChartHelpers_Tooltip as Tooltip, TooltipContent };
128
+ export { ChartContainer, ChartStyles, LegendContent, ChartHelpers_Tooltip as Tooltip, TooltipContent, getInitialDimension };
@@ -2,5 +2,5 @@ import { type ChartProps } from './ChartHelpers';
2
2
  type Props = {
3
3
  enableLegendToggle?: boolean;
4
4
  } & ChartProps;
5
- declare const LineChart: ({ data, legend, keys, enableLegendToggle, axisColor, tooltipLegendPostfix, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ declare const LineChart: ({ data, legend, keys, enableLegendToggle, axisColor, tooltipLegendPostfix, initialDimension, width, height, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
6
6
  export default LineChart;
@@ -3,8 +3,8 @@ import { useTheme } from "@emotion/react";
3
3
  import { useState } from "react";
4
4
  import { CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, XAxis, YAxis } from "recharts";
5
5
  import { formatNumber } from "../utils/formatNumber.js";
6
- import { ChartContainer, ChartStyles, LegendContent, Tooltip } from "./ChartHelpers.js";
7
- const LineChart_LineChart = ({ data, legend, keys, enableLegendToggle, axisColor, tooltipLegendPostfix, ...rest })=>{
6
+ import { ChartContainer, ChartStyles, LegendContent, Tooltip, getInitialDimension } from "./ChartHelpers.js";
7
+ const LineChart_LineChart = ({ data, legend, keys, enableLegendToggle, axisColor, tooltipLegendPostfix, initialDimension, width, height, ...rest })=>{
8
8
  const [lines, setLines] = useState(keys);
9
9
  const { scale2 } = useTheme();
10
10
  const handleLineToggle = (item)=>{
@@ -19,13 +19,17 @@ const LineChart_LineChart = ({ data, legend, keys, enableLegendToggle, axisColor
19
19
  setLines((prevLines)=>toggleLines(prevLines));
20
20
  };
21
21
  const toggleData = enableLegendToggle && keys.length > 1 ? handleLineToggle : void 0;
22
+ const initial = getInitialDimension(initialDimension, width, height);
22
23
  return /*#__PURE__*/ jsxs(ChartContainer, {
24
+ width: width,
25
+ height: height,
23
26
  ...rest,
24
27
  children: [
25
28
  /*#__PURE__*/ jsx(ChartStyles, {}),
26
29
  /*#__PURE__*/ jsx(ResponsiveContainer, {
27
30
  width: "100%",
28
31
  height: "100%",
32
+ initialDimension: initial,
29
33
  children: /*#__PURE__*/ jsxs(LineChart, {
30
34
  margin: {
31
35
  top: 8,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "2.2.2-alpha.7",
3
+ "version": "2.2.2",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -65,12 +65,6 @@
65
65
  "@chromatic-com/storybook": "^4.1.1",
66
66
  "@emotion/babel-plugin": "^11.13.5",
67
67
  "@emotion/react": "^11.14.0",
68
- "@mdx-js/react": "^3.1.1",
69
- "@mdx-js/rollup": "^3.1.1",
70
- "@rollup/plugin-commonjs": "^28.0.9",
71
- "@rollup/plugin-node-resolve": "^16.0.3",
72
- "@rollup/plugin-terser": "^0.4.4",
73
- "@rollup/plugin-typescript": "^11.1.6",
74
68
  "@rsbuild/core": "1.5.17",
75
69
  "@rsbuild/plugin-react": "^1.4.1",
76
70
  "@rsbuild/plugin-svgr": "^1.2.2",
@@ -91,7 +85,6 @@
91
85
  "@types/randomcolor": "^0.5.9",
92
86
  "@types/react": "^19.2.2",
93
87
  "@types/react-dom": "^19.2.2",
94
- "@types/rollup-plugin-peer-deps-external": "^2.2.5",
95
88
  "@types/signale": "^1.4.7",
96
89
  "@types/webfontloader": "^1.6.38",
97
90
  "chalk": "^5.6.2",
@@ -110,10 +103,6 @@
110
103
  "react": "^19.2.0",
111
104
  "react-dom": "^19.2.0",
112
105
  "replace": "^1.2.2",
113
- "rollup": "^4.52.5",
114
- "rollup-plugin-dts": "^6.2.3",
115
- "rollup-plugin-peer-deps-external": "^2.2.4",
116
- "rollup-plugin-postcss": "^4.0.2",
117
106
  "signale": "^1.4.0",
118
107
  "storybook": "^9.1.15",
119
108
  "storybook-react-rsbuild": "^2.1.2",
@@ -132,11 +121,8 @@
132
121
  "start": "storybook dev -p 6006",
133
122
  "dev": "rsbuild dev",
134
123
  "preview": "rsbuild preview",
135
- "roll-lib": "rollup -c --bundleConfigAsCjs",
136
124
  "generate-tailwind-theme": "pnpm exec tsx scripts/generateThemeCSS.ts",
137
125
  "build:lib": "rm -rf build && rslib build && pnpm run generate-tailwind-theme",
138
- "build:watch": "pnpm run roll-lib -w",
139
- "build:old": "rm -rf build && pnpm run roll-lib && pnpm run generate-tailwind-theme",
140
126
  "build": "storybook build -o dist --disable-telemetry",
141
127
  "lint": "biome lint",
142
128
  "lint:ts": "tsc -p tsconfig-lint.json --noEmit",