@mbao01/common 0.7.3 → 0.8.1
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.
- package/dist/types/components/Chart/components/ChartLegend.d.ts +1 -2
- package/dist/types/components/Chart/stories/args/index.d.ts +1 -1
- package/dist/types/components/Chart/types.d.ts +1 -1
- package/dist/types/components/Popover/Popover.d.ts +3 -0
- package/dist/types/components/Resizable/Resizable.d.ts +1 -1
- package/package.json +57 -58
- package/src/components/Chart/components/ChartTooltip.tsx +1 -1
- package/src/components/Chart/stories/args/index.ts +2 -1
- package/src/components/Chart/stories/examples/BarChart.tsx +9 -6
- package/src/components/Chart/types.ts +1 -1
- package/src/components/Popover/Popover.tsx +3 -0
- package/src/stylesheets/tailwind.css +2 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Legend } from 'recharts';
|
|
2
1
|
import { ChartLegendContentProps } from '../types';
|
|
3
|
-
export declare const ChartLegend:
|
|
2
|
+
export declare const ChartLegend: import('react').MemoExoticComponent<(outsideProps: import('recharts').LegendProps) => React.ReactPortal | null>;
|
|
4
3
|
export declare const ChartLegendContent: import('react').ForwardRefExoticComponent<Omit<ChartLegendContentProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -19,7 +19,7 @@ export type LineChartProps = {
|
|
|
19
19
|
export type LineChartArgs = Partial<Flatten<LineChartProps>> & {};
|
|
20
20
|
export declare const lineChartArgs: ArgTypes;
|
|
21
21
|
export type AreaChartProps = {
|
|
22
|
-
area: OmitSVGElement<AreaProps
|
|
22
|
+
area: OmitSVGElement<AreaProps<any, any>>;
|
|
23
23
|
areaChart: CartesianChartProps;
|
|
24
24
|
} & AxisProps;
|
|
25
25
|
export type AreaChartArgs = Partial<Flatten<AreaChartProps>> & {};
|
|
@@ -24,7 +24,7 @@ export type ChartStyleProps = {
|
|
|
24
24
|
id: string;
|
|
25
25
|
config: ChartConfig;
|
|
26
26
|
};
|
|
27
|
-
export type ChartTooltipContentProps = Partial<TooltipContentProps<number | string | (number | string)[], string>> & ComponentProps<"div"> & {
|
|
27
|
+
export type ChartTooltipContentProps = Partial<TooltipContentProps<number | string | readonly (number | string)[], number | string>> & ComponentProps<"div"> & {
|
|
28
28
|
hideLabel?: boolean;
|
|
29
29
|
hideIndicator?: boolean;
|
|
30
30
|
indicator?: "line" | "dot" | "dashed";
|
|
@@ -4,6 +4,9 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
|
4
4
|
declare const Popover: {
|
|
5
5
|
(props: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Content: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
Anchor: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
Close: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
Arrow: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
7
10
|
Trigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
11
|
};
|
|
9
12
|
export { Popover };
|
|
@@ -2,7 +2,7 @@ import { ResizableHandleProps, ResizableProps } from './types';
|
|
|
2
2
|
import * as ResizablePrimitive from "react-resizable-panels";
|
|
3
3
|
declare const Resizable: {
|
|
4
4
|
({ className, ...props }: ResizableProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
Panel: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLElement | HTMLAnchorElement | HTMLSpanElement | HTMLButtonElement | HTMLUListElement | HTMLLIElement | HTMLOListElement | HTMLObjectElement | HTMLLinkElement | HTMLSlotElement | HTMLStyleElement | HTMLTitleElement | HTMLMapElement | HTMLDialogElement |
|
|
5
|
+
Panel: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLAttributes<HTMLElement | HTMLAnchorElement | HTMLSpanElement | HTMLButtonElement | HTMLFormElement | HTMLUListElement | HTMLLIElement | HTMLOListElement | HTMLObjectElement | HTMLLinkElement | HTMLSlotElement | HTMLStyleElement | HTMLTitleElement | HTMLMapElement | HTMLDialogElement | HTMLImageElement | HTMLOptionElement | HTMLTableElement | HTMLTimeElement | HTMLAreaElement | HTMLAudioElement | HTMLBaseElement | HTMLQuoteElement | HTMLBodyElement | HTMLBRElement | HTMLCanvasElement | HTMLTableColElement | HTMLDataElement | HTMLDataListElement | HTMLModElement | HTMLDetailsElement | HTMLDivElement | HTMLDListElement | HTMLEmbedElement | HTMLFieldSetElement | HTMLHeadingElement | HTMLHeadElement | HTMLHRElement | HTMLHtmlElement | HTMLIFrameElement | HTMLInputElement | HTMLLabelElement | HTMLLegendElement | HTMLMetaElement | HTMLMeterElement | HTMLOptGroupElement | HTMLOutputElement | HTMLParagraphElement | HTMLPreElement | HTMLProgressElement | HTMLScriptElement | HTMLSelectElement | HTMLSourceElement | HTMLTemplateElement | HTMLTableSectionElement | HTMLTableCellElement | HTMLTextAreaElement | HTMLTableRowElement | HTMLTrackElement | HTMLVideoElement | HTMLTableCaptionElement | HTMLMenuElement | HTMLPictureElement>, "id" | "onResize"> & {
|
|
6
6
|
className?: string;
|
|
7
7
|
collapsedSize?: number | undefined;
|
|
8
8
|
collapsible?: boolean | undefined;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbao01/common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -45,25 +45,6 @@
|
|
|
45
45
|
"sideEffects": [
|
|
46
46
|
"*.css"
|
|
47
47
|
],
|
|
48
|
-
"scripts": {
|
|
49
|
-
"clean": "pnpx rimraf node_modules",
|
|
50
|
-
"dev": "storybook dev -p 6006",
|
|
51
|
-
"build": "tsc && vite build",
|
|
52
|
-
"build-storybook": "storybook build -o ../../docs/storybook/common",
|
|
53
|
-
"lint": "eslint --report-unused-disable-directives --max-warnings 30",
|
|
54
|
-
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
|
|
55
|
-
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
56
|
-
"preview": "vite preview",
|
|
57
|
-
"prod": "pnpx http-server ../../docs/storybook/common --port 6006",
|
|
58
|
-
"test": "vitest run",
|
|
59
|
-
"test:coverage": "vitest run --coverage",
|
|
60
|
-
"test:ui": "vitest --ui",
|
|
61
|
-
"test:visual": "test-storybook --url http://127.0.0.1:6006",
|
|
62
|
-
"test:visual:coverage": "test-storybook --coverage --url http://127.0.0.1:6006",
|
|
63
|
-
"test:visual:ci": "test-storybook --ci --verbose --url http://127.0.0.1:6006",
|
|
64
|
-
"test:visual:watch": "test-storybook --watch --url http://127.0.0.1:6006",
|
|
65
|
-
"test:watch": "vitest"
|
|
66
|
-
},
|
|
67
48
|
"dependencies": {
|
|
68
49
|
"@dnd-kit/core": "^6.3.1",
|
|
69
50
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
@@ -99,64 +80,64 @@
|
|
|
99
80
|
"cmdk": "^1.1.1",
|
|
100
81
|
"date-fns": "^4.1.0",
|
|
101
82
|
"embla-carousel-react": "^8.6.0",
|
|
102
|
-
"lucide-react": "^0.
|
|
103
|
-
"react-day-picker": "^9.
|
|
104
|
-
"react-dropzone": "^14.
|
|
105
|
-
"react-international-phone": "^4.
|
|
83
|
+
"lucide-react": "^0.577.0",
|
|
84
|
+
"react-day-picker": "^9.14.0",
|
|
85
|
+
"react-dropzone": "^14.4.1",
|
|
86
|
+
"react-international-phone": "^4.8.0",
|
|
106
87
|
"react-otp-input": "^3.1.1",
|
|
107
88
|
"react-resizable-panels": "^3.0.6",
|
|
108
89
|
"sonner": "^2.0.7",
|
|
109
|
-
"tailwind-merge": "^3.
|
|
90
|
+
"tailwind-merge": "^3.5.0",
|
|
110
91
|
"timescape": "^0.8.0",
|
|
111
92
|
"universal-cookie": "^8.0.1",
|
|
112
93
|
"vaul": "^1.1.2"
|
|
113
94
|
},
|
|
114
95
|
"devDependencies": {
|
|
115
|
-
"@eslint/js": "^9.39.
|
|
116
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.7.
|
|
117
|
-
"@storybook/addon-a11y": "^10.
|
|
96
|
+
"@eslint/js": "^9.39.4",
|
|
97
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
|
98
|
+
"@storybook/addon-a11y": "^10.2.19",
|
|
118
99
|
"@storybook/addon-coverage": "^3.0.0",
|
|
119
|
-
"@storybook/addon-docs": "^10.
|
|
120
|
-
"@storybook/addon-links": "^10.
|
|
121
|
-
"@storybook/addon-onboarding": "^10.
|
|
122
|
-
"@storybook/addon-themes": "^10.
|
|
123
|
-
"@storybook/react-vite": "^10.
|
|
100
|
+
"@storybook/addon-docs": "^10.2.19",
|
|
101
|
+
"@storybook/addon-links": "^10.2.19",
|
|
102
|
+
"@storybook/addon-onboarding": "^10.2.19",
|
|
103
|
+
"@storybook/addon-themes": "^10.2.19",
|
|
104
|
+
"@storybook/react-vite": "^10.2.19",
|
|
124
105
|
"@storybook/test-runner": "^0.24.2",
|
|
125
|
-
"@tailwindcss/postcss": "^4.1
|
|
126
|
-
"@tailwindcss/vite": "^4.1
|
|
106
|
+
"@tailwindcss/postcss": "^4.2.1",
|
|
107
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
127
108
|
"@testing-library/jest-dom": "^6.9.1",
|
|
128
|
-
"@testing-library/react": "^16.3.
|
|
109
|
+
"@testing-library/react": "^16.3.2",
|
|
129
110
|
"@testing-library/user-event": "^14.6.1",
|
|
130
|
-
"@types/jest-image-snapshot": "^6.4.
|
|
131
|
-
"@types/node": "^25.0
|
|
132
|
-
"@types/react": "
|
|
133
|
-
"@types/react-dom": "
|
|
134
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
135
|
-
"@typescript-eslint/parser": "^8.
|
|
136
|
-
"@vitejs/plugin-react": "^5.
|
|
111
|
+
"@types/jest-image-snapshot": "^6.4.1",
|
|
112
|
+
"@types/node": "^25.5.0",
|
|
113
|
+
"@types/react": "19.2.14",
|
|
114
|
+
"@types/react-dom": "19.2.3",
|
|
115
|
+
"@typescript-eslint/eslint-plugin": "^8.57.0",
|
|
116
|
+
"@typescript-eslint/parser": "^8.57.0",
|
|
117
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
137
118
|
"@vitest/coverage-v8": "^3.2.4",
|
|
138
119
|
"@vitest/ui": "^3.2.4",
|
|
139
120
|
"axe-playwright": "^2.2.2",
|
|
140
|
-
"daisyui": "^5.5.
|
|
141
|
-
"eslint": "^9.39.
|
|
121
|
+
"daisyui": "^5.5.19",
|
|
122
|
+
"eslint": "^9.39.4",
|
|
142
123
|
"eslint-plugin-react": "^7.37.5",
|
|
143
124
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
144
125
|
"eslint-plugin-react-refresh": "^0.4.26",
|
|
145
|
-
"eslint-plugin-storybook": "^10.
|
|
126
|
+
"eslint-plugin-storybook": "^10.2.19",
|
|
146
127
|
"globals": "^16.5.0",
|
|
147
|
-
"jest-image-snapshot": "^6.5.
|
|
128
|
+
"jest-image-snapshot": "^6.5.2",
|
|
148
129
|
"jsdom": "^27.4.0",
|
|
149
130
|
"path": "^0.12.7",
|
|
150
|
-
"postcss": "^8.5.
|
|
151
|
-
"prettier": "^3.
|
|
152
|
-
"react": "^19.2.
|
|
153
|
-
"react-dom": "^19.2.
|
|
154
|
-
"react-router-dom": "^7.
|
|
155
|
-
"recharts": "^3.
|
|
156
|
-
"storybook": "^10.
|
|
157
|
-
"tailwindcss": "^4.1
|
|
131
|
+
"postcss": "^8.5.8",
|
|
132
|
+
"prettier": "^3.8.1",
|
|
133
|
+
"react": "^19.2.4",
|
|
134
|
+
"react-dom": "^19.2.4",
|
|
135
|
+
"react-router-dom": "^7.13.1",
|
|
136
|
+
"recharts": "^3.8.0",
|
|
137
|
+
"storybook": "^10.2.19",
|
|
138
|
+
"tailwindcss": "^4.2.1",
|
|
158
139
|
"typescript": "^5.9.3",
|
|
159
|
-
"typescript-eslint": "^8.
|
|
140
|
+
"typescript-eslint": "^8.57.0",
|
|
160
141
|
"vite": "^6.4.1",
|
|
161
142
|
"vite-plugin-dts": "^4.5.4",
|
|
162
143
|
"vitest": "^3.2.4"
|
|
@@ -168,5 +149,23 @@
|
|
|
168
149
|
"recharts": "2",
|
|
169
150
|
"typescript": "5"
|
|
170
151
|
},
|
|
171
|
-
"
|
|
172
|
-
|
|
152
|
+
"scripts": {
|
|
153
|
+
"clean": "pnpx rimraf node_modules",
|
|
154
|
+
"dev": "storybook dev -p 6006",
|
|
155
|
+
"build": "tsc && vite build",
|
|
156
|
+
"build-storybook": "storybook build -o ../../docs/storybook/common",
|
|
157
|
+
"lint": "eslint --report-unused-disable-directives --max-warnings 30",
|
|
158
|
+
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
|
|
159
|
+
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
160
|
+
"preview": "vite preview",
|
|
161
|
+
"prod": "pnpx http-server ../../docs/storybook/common --port 6006",
|
|
162
|
+
"test": "vitest run",
|
|
163
|
+
"test:coverage": "vitest run --coverage",
|
|
164
|
+
"test:ui": "vitest --ui",
|
|
165
|
+
"test:visual": "test-storybook --url http://127.0.0.1:6006",
|
|
166
|
+
"test:visual:coverage": "test-storybook --coverage --url http://127.0.0.1:6006",
|
|
167
|
+
"test:visual:ci": "test-storybook --ci --verbose --url http://127.0.0.1:6006",
|
|
168
|
+
"test:visual:watch": "test-storybook --watch --url http://127.0.0.1:6006",
|
|
169
|
+
"test:watch": "vitest"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -83,7 +83,7 @@ export const ChartTooltipContent = forwardRef<HTMLDivElement, ChartTooltipConten
|
|
|
83
83
|
(item as { fill: string }).fill;
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
|
-
<div key={item.
|
|
86
|
+
<div key={item.graphicalItemId} className={getChartTooltipItemClasses({ indicator })}>
|
|
87
87
|
{formatter && item?.value !== undefined && item.name ? (
|
|
88
88
|
formatter(item.value, item.name, item, index, payload)
|
|
89
89
|
) : (
|
|
@@ -91,7 +91,8 @@ export const lineChartArgs: ArgTypes = {
|
|
|
91
91
|
type AreaArgKey = "area" | "areaChart" | "xAxis" | "yAxis";
|
|
92
92
|
|
|
93
93
|
export type AreaChartProps = {
|
|
94
|
-
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
95
|
+
area: OmitSVGElement<AreaProps<any, any>>;
|
|
95
96
|
areaChart: CartesianChartProps;
|
|
96
97
|
} & AxisProps;
|
|
97
98
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import {
|
|
2
3
|
Bar,
|
|
3
4
|
BarChart,
|
|
@@ -166,12 +167,14 @@ export const BarChartExample = (props: Partial<BarChartProps>) => {
|
|
|
166
167
|
<ChartTooltipContent
|
|
167
168
|
className="w-[150px]"
|
|
168
169
|
nameKey="views"
|
|
169
|
-
labelFormatter={(value:
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
170
|
+
labelFormatter={(value: ReactNode) => {
|
|
171
|
+
return typeof value === "string"
|
|
172
|
+
? new Date(value).toLocaleDateString("en-US", {
|
|
173
|
+
month: "short",
|
|
174
|
+
day: "numeric",
|
|
175
|
+
year: "numeric",
|
|
176
|
+
})
|
|
177
|
+
: value;
|
|
175
178
|
}}
|
|
176
179
|
/>
|
|
177
180
|
}
|
|
@@ -30,7 +30,7 @@ export type ChartStyleProps = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export type ChartTooltipContentProps = Partial<
|
|
33
|
-
TooltipContentProps<number | string | (number | string)[], string>
|
|
33
|
+
TooltipContentProps<number | string | readonly (number | string)[], number | string>
|
|
34
34
|
> &
|
|
35
35
|
ComponentProps<"div"> & {
|
|
36
36
|
hideLabel?: boolean;
|
|
@@ -25,6 +25,9 @@ const PopoverContent = React.forwardRef<
|
|
|
25
25
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
26
26
|
|
|
27
27
|
Popover.Content = PopoverContent;
|
|
28
|
+
Popover.Anchor = PopoverPrimitive.Anchor;
|
|
29
|
+
Popover.Close = PopoverPrimitive.Close;
|
|
30
|
+
Popover.Arrow = PopoverPrimitive.Arrow;
|
|
28
31
|
Popover.Trigger = PopoverPrimitive.Trigger;
|
|
29
32
|
|
|
30
33
|
export { Popover };
|