@mbao01/common 0.0.46 → 0.0.47
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/helpers.d.ts +3 -1
- package/dist/types/components/Chart/stories/args/index.d.ts +63 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +1 -1
- package/dist/types/components/Menu/Menubar/Menubar.d.ts +42 -0
- package/dist/types/components/Menu/Menubar/types.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +59 -59
- package/src/components/Chart/helpers.ts +14 -8
- package/src/components/Chart/stories/args/index.ts +12 -12
- package/src/components/Menu/Menubar/Menubar.tsx +5 -1
- package/src/components/Menu/Menubar/types.ts +2 -0
- package/src/index.ts +2 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { NameType, Payload as TooltipPayload, ValueType } from 'recharts/types/component/DefaultTooltipContent';
|
|
2
|
+
import { Payload as LegendPayload } from 'recharts/types/component/DefaultLegendContent';
|
|
1
3
|
import { ChartConfig } from './types';
|
|
2
|
-
export declare const getPayloadConfigFromPayload: (config: ChartConfig, payload:
|
|
4
|
+
export declare const getPayloadConfigFromPayload: (config: ChartConfig, payload: LegendPayload | TooltipPayload<ValueType, NameType>, key: string) => ({
|
|
3
5
|
label?: import('react').ReactNode;
|
|
4
6
|
icon?: import('react').ComponentType;
|
|
5
7
|
} & ({
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AreaProps, BarProps, LineProps, PieProps, RadarProps, RadialBarProps, XAxisProps, YAxisProps } from 'recharts';
|
|
2
|
+
import { ArgTypes } from '@storybook/react';
|
|
3
|
+
import { CategoricalChartProps } from 'recharts/types/chart/generateCategoricalChart';
|
|
4
|
+
import { Flatten, OmitSVGElement } from './types';
|
|
5
|
+
type AxisProps = {
|
|
6
|
+
xAxis: OmitSVGElement<XAxisProps>;
|
|
7
|
+
yAxis: OmitSVGElement<YAxisProps>;
|
|
8
|
+
};
|
|
9
|
+
export type BarChartProps = {
|
|
10
|
+
bar: OmitSVGElement<BarProps>;
|
|
11
|
+
barChart: CategoricalChartProps;
|
|
12
|
+
} & AxisProps;
|
|
13
|
+
export type BarChartArgs = Partial<Flatten<BarChartProps>> & {};
|
|
14
|
+
export declare const barChartArgs: ArgTypes;
|
|
15
|
+
export type LineChartProps = {
|
|
16
|
+
line: OmitSVGElement<LineProps>;
|
|
17
|
+
lineChart: CategoricalChartProps;
|
|
18
|
+
} & AxisProps;
|
|
19
|
+
export type LineChartArgs = Partial<Flatten<LineChartProps>> & {};
|
|
20
|
+
export declare const lineChartArgs: ArgTypes;
|
|
21
|
+
export type AreaChartProps = {
|
|
22
|
+
area: OmitSVGElement<AreaProps>;
|
|
23
|
+
areaChart: CategoricalChartProps;
|
|
24
|
+
} & AxisProps;
|
|
25
|
+
export type AreaChartArgs = Partial<Flatten<AreaChartProps>> & {};
|
|
26
|
+
export declare const areaArgKey: {
|
|
27
|
+
area: "area";
|
|
28
|
+
areaChart: "areaChart";
|
|
29
|
+
xAxis: "xAxis";
|
|
30
|
+
yAxis: "yAxis";
|
|
31
|
+
};
|
|
32
|
+
export declare const areaChartArgs: ArgTypes;
|
|
33
|
+
export type PieChartProps = {
|
|
34
|
+
pie: OmitSVGElement<PieProps>;
|
|
35
|
+
pieChart: CategoricalChartProps;
|
|
36
|
+
};
|
|
37
|
+
export type PieChartArgs = Partial<Flatten<PieChartProps>> & {};
|
|
38
|
+
export declare const pieArgKey: {
|
|
39
|
+
pie: "pie";
|
|
40
|
+
pieChart: "pieChart";
|
|
41
|
+
};
|
|
42
|
+
export declare const pieChartArgs: ArgTypes;
|
|
43
|
+
export type RadialBarChartProps = {
|
|
44
|
+
radialBar: OmitSVGElement<RadialBarProps>;
|
|
45
|
+
radialBarChart: CategoricalChartProps;
|
|
46
|
+
};
|
|
47
|
+
export type RadialBarChartArgs = Partial<Flatten<RadialBarChartProps>> & {};
|
|
48
|
+
export declare const radialBarArgKey: {
|
|
49
|
+
radialBar: "radialBar";
|
|
50
|
+
radialBarChart: "radialBarChart";
|
|
51
|
+
};
|
|
52
|
+
export declare const radialBarChartArgs: ArgTypes;
|
|
53
|
+
export type RadarChartProps = {
|
|
54
|
+
radar: OmitSVGElement<RadarProps>;
|
|
55
|
+
radarChart: CategoricalChartProps;
|
|
56
|
+
};
|
|
57
|
+
export type RadarChartArgs = Partial<Flatten<RadarChartProps>> & {};
|
|
58
|
+
export declare const radarArgKey: {
|
|
59
|
+
radar: "radar";
|
|
60
|
+
radarChart: "radarChart";
|
|
61
|
+
};
|
|
62
|
+
export declare const radarChartArgs: ArgTypes;
|
|
63
|
+
export {};
|
|
@@ -53,7 +53,7 @@ export declare const DatetimeInput: import('react').ForwardRefExoticComponent<{
|
|
|
53
53
|
modifiers?: Record<string, import('react-day-picker').Matcher | import('react-day-picker').Matcher[] | undefined> | undefined;
|
|
54
54
|
labels?: Partial<import('react-day-picker').Labels> | undefined;
|
|
55
55
|
formatters?: Partial<import('react-day-picker').Formatters> | undefined;
|
|
56
|
-
locale?: Partial<import('
|
|
56
|
+
locale?: Partial<import('date-fns').Locale> | undefined;
|
|
57
57
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
58
58
|
firstWeekContainsDate?: (1 | 4) | undefined;
|
|
59
59
|
useAdditionalWeekYearTokens?: boolean | undefined;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { MenubarMenuProps, MenubarProps, MenubarShortcutProps } from './types';
|
|
2
|
+
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
3
|
+
declare const Menubar: {
|
|
4
|
+
({ className, ...props }: MenubarProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
displayName: string | undefined;
|
|
6
|
+
Menu: {
|
|
7
|
+
(props: MenubarMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
Group: import('react').ForwardRefExoticComponent<MenubarPrimitive.MenubarGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
11
|
+
Portal: import('react').FC<MenubarPrimitive.MenubarPortalProps>;
|
|
12
|
+
Sub: import('react').FC<MenubarPrimitive.MenubarSubProps>;
|
|
13
|
+
RadioGroup: import('react').ForwardRefExoticComponent<MenubarPrimitive.MenubarRadioGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
14
|
+
Trigger: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarTriggerProps & import('react').RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
15
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" | undefined;
|
|
16
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
Content: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarContentProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {} & import('react').RefAttributes<HTMLDivElement>>;
|
|
18
|
+
Item: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarItemProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
19
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" | undefined;
|
|
20
|
+
inset?: boolean | undefined;
|
|
21
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
22
|
+
Separator: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSeparatorProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {} & import('react').RefAttributes<HTMLDivElement>>;
|
|
23
|
+
Label: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarLabelProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
24
|
+
inset?: boolean | undefined;
|
|
25
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
26
|
+
CheckboxItem: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarCheckboxItemProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
27
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" | undefined;
|
|
28
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
29
|
+
RadioItem: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarRadioItemProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
30
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" | undefined;
|
|
31
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
32
|
+
SubContent: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSubContentProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {} & import('react').RefAttributes<HTMLDivElement>>;
|
|
33
|
+
SubTrigger: import('react').ForwardRefExoticComponent<Omit<MenubarPrimitive.MenubarSubTriggerProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
34
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" | undefined;
|
|
35
|
+
inset?: boolean | undefined;
|
|
36
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
37
|
+
Shortcut: {
|
|
38
|
+
({ className, ...props }: MenubarShortcutProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
displayname: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export { Menubar };
|
|
@@ -2,6 +2,7 @@ import { VariantProps } from '../../../libs';
|
|
|
2
2
|
import { getMenubarCheckboxItemClasses, getMenubarContentClasses, getMenubarItemClasses, getMenubarLabelClasses, getMenubarRadioItemClasses, getMenubarSeparatorClasses, getMenubarShortcutClasses, getMenubarSubContentClasses, getMenubarSubTriggerClasses, getMenubarTriggerClasses } from './constants';
|
|
3
3
|
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
|
4
4
|
export type MenubarProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>;
|
|
5
|
+
export type MenubarMenuProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Menu>;
|
|
5
6
|
export type MenubarTriggerProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger> & VariantProps<typeof getMenubarTriggerClasses>;
|
|
6
7
|
export type MenubarSubTriggerProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.SubTrigger> & VariantProps<typeof getMenubarSubTriggerClasses>;
|
|
7
8
|
export type MenubarContentProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Content> & VariantProps<typeof getMenubarContentClasses>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,8 +35,10 @@ export * from './components/Skeleton';
|
|
|
35
35
|
export * from './components/Tooltip';
|
|
36
36
|
/** composable */
|
|
37
37
|
export * from './components/AlertDialog';
|
|
38
|
+
export * from './components/Chart';
|
|
38
39
|
export * from './components/Command';
|
|
39
40
|
export * from './components/Dialog';
|
|
40
41
|
export * from './components/HoverCard';
|
|
41
42
|
export * from './components/Popover';
|
|
42
43
|
export * from './components/Slot';
|
|
44
|
+
export * from './components/Widget';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbao01/common",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.47",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"test:coverage": "vitest run --coverage",
|
|
63
63
|
"test:ui": "vitest --ui",
|
|
64
64
|
"test:visual": "test-storybook --url http://127.0.0.1:6006",
|
|
65
|
-
"test:visual:coverage": "test-storybook --coverage",
|
|
65
|
+
"test:visual:coverage": "test-storybook --coverage --url http://127.0.0.1:6006",
|
|
66
66
|
"test:visual:ci": "test-storybook --ci --verbose --url http://127.0.0.1:6006",
|
|
67
|
-
"test:visual:watch": "test-storybook --watch",
|
|
67
|
+
"test:visual:watch": "test-storybook --watch --url http://127.0.0.1:6006",
|
|
68
68
|
"test:watch": "vitest"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
@@ -72,82 +72,82 @@
|
|
|
72
72
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
73
73
|
"@dnd-kit/sortable": "^8.0.0",
|
|
74
74
|
"@dnd-kit/utilities": "^3.2.2",
|
|
75
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
76
|
-
"@radix-ui/react-alert-dialog": "^1.1.
|
|
77
|
-
"@radix-ui/react-avatar": "^1.1.
|
|
78
|
-
"@radix-ui/react-checkbox": "^1.1.
|
|
79
|
-
"@radix-ui/react-collapsible": "^1.1.
|
|
80
|
-
"@radix-ui/react-context-menu": "^2.2.
|
|
81
|
-
"@radix-ui/react-dialog": "^1.1.
|
|
82
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
83
|
-
"@radix-ui/react-hover-card": "^1.1.
|
|
75
|
+
"@radix-ui/react-accordion": "^1.2.1",
|
|
76
|
+
"@radix-ui/react-alert-dialog": "^1.1.2",
|
|
77
|
+
"@radix-ui/react-avatar": "^1.1.1",
|
|
78
|
+
"@radix-ui/react-checkbox": "^1.1.2",
|
|
79
|
+
"@radix-ui/react-collapsible": "^1.1.1",
|
|
80
|
+
"@radix-ui/react-context-menu": "^2.2.2",
|
|
81
|
+
"@radix-ui/react-dialog": "^1.1.2",
|
|
82
|
+
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
83
|
+
"@radix-ui/react-hover-card": "^1.1.2",
|
|
84
84
|
"@radix-ui/react-icons": "^1.3.0",
|
|
85
85
|
"@radix-ui/react-label": "^2.1.0",
|
|
86
|
-
"@radix-ui/react-menubar": "^1.1.
|
|
87
|
-
"@radix-ui/react-navigation-menu": "^1.2.
|
|
88
|
-
"@radix-ui/react-popover": "^1.1.
|
|
86
|
+
"@radix-ui/react-menubar": "^1.1.2",
|
|
87
|
+
"@radix-ui/react-navigation-menu": "^1.2.1",
|
|
88
|
+
"@radix-ui/react-popover": "^1.1.2",
|
|
89
89
|
"@radix-ui/react-progress": "^1.1.0",
|
|
90
|
-
"@radix-ui/react-scroll-area": "^1.
|
|
91
|
-
"@radix-ui/react-select": "^2.1.
|
|
90
|
+
"@radix-ui/react-scroll-area": "^1.2.0",
|
|
91
|
+
"@radix-ui/react-select": "^2.1.2",
|
|
92
92
|
"@radix-ui/react-separator": "^1.1.0",
|
|
93
|
-
"@radix-ui/react-slider": "^1.2.
|
|
93
|
+
"@radix-ui/react-slider": "^1.2.1",
|
|
94
94
|
"@radix-ui/react-slot": "^1.1.0",
|
|
95
|
-
"@radix-ui/react-tabs": "^1.1.
|
|
95
|
+
"@radix-ui/react-tabs": "^1.1.1",
|
|
96
96
|
"@radix-ui/react-toggle": "^1.1.0",
|
|
97
97
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
|
98
|
-
"@radix-ui/react-tooltip": "^1.1.
|
|
98
|
+
"@radix-ui/react-tooltip": "^1.1.3",
|
|
99
99
|
"@tailwindcss/typography": "^0.5.15",
|
|
100
100
|
"chrono-node": "^2.7.7",
|
|
101
101
|
"class-variance-authority": "^0.7.0",
|
|
102
102
|
"clsx": "^2.1.1",
|
|
103
103
|
"cmdk": "^1.0.0",
|
|
104
|
-
"daisyui": "^4.12.
|
|
104
|
+
"daisyui": "^4.12.13",
|
|
105
105
|
"embla-carousel-react": "^8.3.0",
|
|
106
|
-
"react-dropzone": "^14.2.
|
|
106
|
+
"react-dropzone": "^14.2.10",
|
|
107
107
|
"react-international-phone": "^4.3.0",
|
|
108
108
|
"react-otp-input": "^3.1.1",
|
|
109
|
-
"recharts": "^2.
|
|
109
|
+
"recharts": "^2.13.0",
|
|
110
110
|
"sonner": "^1.5.0",
|
|
111
|
-
"tailwind-merge": "^2.5.
|
|
111
|
+
"tailwind-merge": "^2.5.4",
|
|
112
112
|
"tailwindcss-animate": "^1.0.7",
|
|
113
|
-
"universal-cookie": "^7.2.
|
|
114
|
-
"vaul": "^1.
|
|
113
|
+
"universal-cookie": "^7.2.1",
|
|
114
|
+
"vaul": "^1.1.0"
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
|
|
118
|
-
"@storybook/addon-a11y": "^8.3.
|
|
118
|
+
"@storybook/addon-a11y": "^8.3.6",
|
|
119
119
|
"@storybook/addon-coverage": "^1.0.4",
|
|
120
|
-
"@storybook/addon-essentials": "^8.3.
|
|
121
|
-
"@storybook/addon-interactions": "^8.3.
|
|
122
|
-
"@storybook/addon-links": "^8.3.
|
|
123
|
-
"@storybook/addon-onboarding": "^8.3.
|
|
124
|
-
"@storybook/addon-storysource": "^8.3.
|
|
125
|
-
"@storybook/addon-themes": "^8.3.
|
|
126
|
-
"@storybook/addon-viewport": "^8.3.
|
|
127
|
-
"@storybook/blocks": "^8.3.
|
|
128
|
-
"@storybook/react": "^8.3.
|
|
129
|
-
"@storybook/react-vite": "^8.3.
|
|
130
|
-
"@storybook/test": "^8.3.
|
|
120
|
+
"@storybook/addon-essentials": "^8.3.6",
|
|
121
|
+
"@storybook/addon-interactions": "^8.3.6",
|
|
122
|
+
"@storybook/addon-links": "^8.3.6",
|
|
123
|
+
"@storybook/addon-onboarding": "^8.3.6",
|
|
124
|
+
"@storybook/addon-storysource": "^8.3.6",
|
|
125
|
+
"@storybook/addon-themes": "^8.3.6",
|
|
126
|
+
"@storybook/addon-viewport": "^8.3.6",
|
|
127
|
+
"@storybook/blocks": "^8.3.6",
|
|
128
|
+
"@storybook/react": "^8.3.6",
|
|
129
|
+
"@storybook/react-vite": "^8.3.6",
|
|
130
|
+
"@storybook/test": "^8.3.6",
|
|
131
131
|
"@storybook/test-runner": "^0.19.1",
|
|
132
|
-
"@testing-library/jest-dom": "^6.
|
|
132
|
+
"@testing-library/jest-dom": "^6.6.2",
|
|
133
133
|
"@testing-library/react": "^16.0.1",
|
|
134
134
|
"@testing-library/user-event": "^14.5.2",
|
|
135
135
|
"@types/jest-image-snapshot": "^6.4.0",
|
|
136
|
-
"@types/node": "^22.7.
|
|
137
|
-
"@types/react": "^18.3.
|
|
138
|
-
"@types/react-dom": "^18.3.
|
|
139
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
140
|
-
"@typescript-eslint/parser": "^8.
|
|
141
|
-
"@vitejs/plugin-react": "^4.3.
|
|
142
|
-
"@vitest/coverage-v8": "^2.1.
|
|
143
|
-
"@vitest/ui": "^2.1.
|
|
136
|
+
"@types/node": "^22.7.9",
|
|
137
|
+
"@types/react": "^18.3.12",
|
|
138
|
+
"@types/react-dom": "^18.3.1",
|
|
139
|
+
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
|
140
|
+
"@typescript-eslint/parser": "^8.11.0",
|
|
141
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
142
|
+
"@vitest/coverage-v8": "^2.1.3",
|
|
143
|
+
"@vitest/ui": "^2.1.3",
|
|
144
144
|
"autoprefixer": "^10.4.20",
|
|
145
145
|
"axe-playwright": "^2.0.3",
|
|
146
146
|
"date-fns": "^4.1.0",
|
|
147
147
|
"eslint": "^8.57.1",
|
|
148
|
-
"eslint-plugin-react": "^7.37.
|
|
148
|
+
"eslint-plugin-react": "^7.37.2",
|
|
149
149
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
150
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
150
|
+
"eslint-plugin-react-refresh": "^0.4.13",
|
|
151
151
|
"eslint-plugin-storybook": "^0.9.0",
|
|
152
152
|
"jest-image-snapshot": "^6.4.0",
|
|
153
153
|
"jsdom": "^25.0.1",
|
|
@@ -155,21 +155,21 @@
|
|
|
155
155
|
"postcss": "^8.4.47",
|
|
156
156
|
"prettier": "^3.3.3",
|
|
157
157
|
"react": "^18.3.1",
|
|
158
|
-
"react-day-picker": "^9.
|
|
158
|
+
"react-day-picker": "^9.2.0",
|
|
159
159
|
"react-dom": "^18.3.1",
|
|
160
|
-
"react-router-dom": "^6.
|
|
161
|
-
"storybook": "^8.3.
|
|
162
|
-
"tailwindcss": "^3.4.
|
|
163
|
-
"timescape": "^0.
|
|
164
|
-
"typescript": "^5.6.
|
|
165
|
-
"vite": "^5.4.
|
|
166
|
-
"vite-plugin-dts": "^4.
|
|
167
|
-
"vitest": "^2.1.
|
|
160
|
+
"react-router-dom": "^6.27.0",
|
|
161
|
+
"storybook": "^8.3.6",
|
|
162
|
+
"tailwindcss": "^3.4.14",
|
|
163
|
+
"timescape": "^0.6.1",
|
|
164
|
+
"typescript": "^5.6.3",
|
|
165
|
+
"vite": "^5.4.10",
|
|
166
|
+
"vite-plugin-dts": "^4.3.0",
|
|
167
|
+
"vitest": "^2.1.3"
|
|
168
168
|
},
|
|
169
169
|
"peerDependencies": {
|
|
170
170
|
"react": "^18.2.0",
|
|
171
171
|
"react-dom": "^18.2.0",
|
|
172
172
|
"typescript": "^5.2.2"
|
|
173
173
|
},
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "072705c2bbc597d54185c788469a97cb32ad145f"
|
|
175
175
|
}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
NameType,
|
|
3
|
+
Payload as TooltipPayload,
|
|
4
|
+
ValueType,
|
|
5
|
+
} from "recharts/types/component/DefaultTooltipContent";
|
|
6
|
+
import { type Payload as LegendPayload } from "recharts/types/component/DefaultLegendContent";
|
|
1
7
|
import { type ChartConfig } from "./types";
|
|
2
8
|
|
|
3
9
|
// Helper to extract item config from a payload.
|
|
4
|
-
export const getPayloadConfigFromPayload = (
|
|
10
|
+
export const getPayloadConfigFromPayload = (
|
|
11
|
+
config: ChartConfig,
|
|
12
|
+
payload: LegendPayload | TooltipPayload<ValueType, NameType>,
|
|
13
|
+
key: string
|
|
14
|
+
) => {
|
|
5
15
|
if (typeof payload !== "object" || payload === null) {
|
|
6
16
|
return undefined;
|
|
7
17
|
}
|
|
8
18
|
|
|
9
19
|
const payloadPayload =
|
|
10
20
|
"payload" in payload && typeof payload.payload === "object" && payload.payload !== null
|
|
11
|
-
? payload.payload
|
|
21
|
+
? (payload.payload as Record<string, unknown>)
|
|
12
22
|
: undefined;
|
|
13
23
|
|
|
14
24
|
let configLabelKey: string = key;
|
|
15
25
|
|
|
16
26
|
if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
|
|
17
27
|
configLabelKey = payload[key as keyof typeof payload] as string;
|
|
18
|
-
} else if (
|
|
19
|
-
payloadPayload
|
|
20
|
-
key in payloadPayload &&
|
|
21
|
-
typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
|
|
22
|
-
) {
|
|
23
|
-
configLabelKey = payloadPayload[key as keyof typeof payloadPayload] as string;
|
|
28
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
29
|
+
configLabelKey = payloadPayload[key];
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
@@ -52,12 +52,12 @@ const barArgKey = {
|
|
|
52
52
|
yAxis: "yAxis",
|
|
53
53
|
} satisfies Record<string, BarArgKey>;
|
|
54
54
|
|
|
55
|
-
export const barChartArgs = {
|
|
55
|
+
export const barChartArgs: ArgTypes = {
|
|
56
56
|
...categorizeArgs(barChartComponentArgs, barArgKey.barChart),
|
|
57
57
|
...categorizeArgs(xAxisArgs, barArgKey.xAxis),
|
|
58
58
|
...categorizeArgs(yAxisArgs, barArgKey.yAxis),
|
|
59
59
|
...categorizeArgs(barArgs, barArgKey.bar),
|
|
60
|
-
}
|
|
60
|
+
};
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
* Line chart
|
|
@@ -78,12 +78,12 @@ const lineArgKey = {
|
|
|
78
78
|
yAxis: "yAxis",
|
|
79
79
|
} satisfies Record<string, LineArgKey>;
|
|
80
80
|
|
|
81
|
-
export const lineChartArgs = {
|
|
81
|
+
export const lineChartArgs: ArgTypes = {
|
|
82
82
|
...categorizeArgs(lineChartComponentArgs, lineArgKey.lineChart),
|
|
83
83
|
...categorizeArgs(xAxisArgs, lineArgKey.xAxis),
|
|
84
84
|
...categorizeArgs(yAxisArgs, lineArgKey.yAxis),
|
|
85
85
|
...categorizeArgs(lineArgs, lineArgKey.line),
|
|
86
|
-
}
|
|
86
|
+
};
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
89
|
* Area chart
|
|
@@ -104,12 +104,12 @@ export const areaArgKey = {
|
|
|
104
104
|
yAxis: "yAxis",
|
|
105
105
|
} satisfies Record<string, AreaArgKey>;
|
|
106
106
|
|
|
107
|
-
export const areaChartArgs = {
|
|
107
|
+
export const areaChartArgs: ArgTypes = {
|
|
108
108
|
...categorizeArgs(areaChartComponentArgs, areaArgKey.areaChart),
|
|
109
109
|
...categorizeArgs(xAxisArgs, areaArgKey.xAxis),
|
|
110
110
|
...categorizeArgs(yAxisArgs, areaArgKey.yAxis),
|
|
111
111
|
...categorizeArgs(areaArgs, areaArgKey.area),
|
|
112
|
-
}
|
|
112
|
+
};
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Pie chart
|
|
@@ -128,10 +128,10 @@ export const pieArgKey = {
|
|
|
128
128
|
pieChart: "pieChart",
|
|
129
129
|
} satisfies Record<string, PieArgKey>;
|
|
130
130
|
|
|
131
|
-
export const pieChartArgs = {
|
|
131
|
+
export const pieChartArgs: ArgTypes = {
|
|
132
132
|
...categorizeArgs(pieChartComponentArgs, pieArgKey.pieChart),
|
|
133
133
|
...categorizeArgs(pieArgs, pieArgKey.pie),
|
|
134
|
-
}
|
|
134
|
+
};
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* RadialBar chart
|
|
@@ -150,10 +150,10 @@ export const radialBarArgKey = {
|
|
|
150
150
|
radialBarChart: "radialBarChart",
|
|
151
151
|
} satisfies Record<string, RadialBarArgKey>;
|
|
152
152
|
|
|
153
|
-
export const radialBarChartArgs = {
|
|
153
|
+
export const radialBarChartArgs: ArgTypes = {
|
|
154
154
|
...categorizeArgs(radialBarChartComponentArgs, radialBarArgKey.radialBarChart),
|
|
155
155
|
...categorizeArgs(radialBarArgs, radialBarArgKey.radialBar),
|
|
156
|
-
}
|
|
156
|
+
};
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
159
|
* Radar chart
|
|
@@ -172,7 +172,7 @@ export const radarArgKey = {
|
|
|
172
172
|
radarChart: "radarChart",
|
|
173
173
|
} satisfies Record<string, RadarArgKey>;
|
|
174
174
|
|
|
175
|
-
export const radarChartArgs = {
|
|
175
|
+
export const radarChartArgs: ArgTypes = {
|
|
176
176
|
...categorizeArgs(radarChartComponentArgs, radarArgKey.radarChart),
|
|
177
177
|
...categorizeArgs(radarArgs, radarArgKey.radar),
|
|
178
|
-
}
|
|
178
|
+
};
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
MenubarContentProps,
|
|
9
9
|
MenubarItemProps,
|
|
10
10
|
MenubarLabelProps,
|
|
11
|
+
MenubarMenuProps,
|
|
11
12
|
MenubarProps,
|
|
12
13
|
MenubarRadioItemProps,
|
|
13
14
|
MenubarSeparatorProps,
|
|
@@ -36,6 +37,9 @@ const Menubar = ({ className, ...props }: MenubarProps) => (
|
|
|
36
37
|
);
|
|
37
38
|
Menubar.displayName = MenubarPrimitive.Root.displayName;
|
|
38
39
|
|
|
40
|
+
const MenubarMenu = (props: MenubarMenuProps) => <MenubarPrimitive.Menu {...props} />;
|
|
41
|
+
MenubarMenu.displayName = MenubarPrimitive.Menu.displayName;
|
|
42
|
+
|
|
39
43
|
const MenubarTrigger = forwardRef<
|
|
40
44
|
React.ElementRef<typeof MenubarPrimitive.Trigger>,
|
|
41
45
|
MenubarTriggerProps
|
|
@@ -169,7 +173,7 @@ const MenubarShortcut = ({ className, ...props }: MenubarShortcutProps) => {
|
|
|
169
173
|
};
|
|
170
174
|
MenubarShortcut.displayname = "MenubarShortcut";
|
|
171
175
|
|
|
172
|
-
Menubar.Menu =
|
|
176
|
+
Menubar.Menu = MenubarMenu;
|
|
173
177
|
Menubar.Group = MenubarPrimitive.Group;
|
|
174
178
|
Menubar.Portal = MenubarPrimitive.Portal;
|
|
175
179
|
Menubar.Sub = MenubarPrimitive.Sub;
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
|
|
16
16
|
export type MenubarProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Root>;
|
|
17
17
|
|
|
18
|
+
export type MenubarMenuProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Menu>;
|
|
19
|
+
|
|
18
20
|
export type MenubarTriggerProps = React.ComponentPropsWithoutRef<typeof MenubarPrimitive.Trigger> &
|
|
19
21
|
VariantProps<typeof getMenubarTriggerClasses>;
|
|
20
22
|
|
package/src/index.ts
CHANGED
|
@@ -39,8 +39,10 @@ export * from "./components/Tooltip";
|
|
|
39
39
|
|
|
40
40
|
/** composable */
|
|
41
41
|
export * from "./components/AlertDialog";
|
|
42
|
+
export * from "./components/Chart";
|
|
42
43
|
export * from "./components/Command";
|
|
43
44
|
export * from "./components/Dialog";
|
|
44
45
|
export * from "./components/HoverCard";
|
|
45
46
|
export * from "./components/Popover";
|
|
46
47
|
export * from "./components/Slot";
|
|
48
|
+
export * from "./components/Widget";
|