@mbao01/common 0.0.43 → 0.0.45
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/Chart.d.ts +2 -0
- package/dist/types/components/Chart/ChartContext.d.ts +2 -0
- package/dist/types/components/Chart/components/ChartLegend.d.ts +4 -0
- package/dist/types/components/Chart/components/ChartStyle.d.ts +2 -0
- package/dist/types/components/Chart/components/ChartTooltip.d.ts +4 -0
- package/dist/types/components/Chart/components/index.d.ts +3 -0
- package/dist/types/components/Chart/constants.d.ts +22 -0
- package/dist/types/components/Chart/helpers.d.ts +11 -0
- package/dist/types/components/Chart/hooks/index.d.ts +1 -0
- package/dist/types/components/Chart/hooks/useChart/index.d.ts +1 -0
- package/dist/types/components/Chart/hooks/useChart/useChart.d.ts +1 -0
- package/dist/types/components/Chart/index.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/activeShapeArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/animationArgs.d.ts +12 -0
- package/dist/types/components/Chart/stories/args/areaArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/areaChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/barArgs.d.ts +5 -0
- package/dist/types/components/Chart/stories/args/barChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/cartesianChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/cartesianSharedArgs.d.ts +11 -0
- package/dist/types/components/Chart/stories/args/chartArgs.d.ts +6 -0
- package/dist/types/components/Chart/stories/args/dotArgs.d.ts +10 -0
- package/dist/types/components/Chart/stories/args/events.d.ts +804 -0
- package/dist/types/components/Chart/stories/args/labelListArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/legendArgs.d.ts +3 -0
- package/dist/types/components/Chart/stories/args/lineArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/lineChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/pieArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/pieChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/polarChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/polarSharedArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radarArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radarChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radialBarArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radialBarChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/rectangleArgs.d.ts +9 -0
- package/dist/types/components/Chart/stories/args/referenceSharedArgs.d.ts +4 -0
- package/dist/types/components/Chart/stories/args/sectorArgs.d.ts +7 -0
- package/dist/types/components/Chart/stories/args/sharedAxisArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/stylesArgs.d.ts +6 -0
- package/dist/types/components/Chart/stories/args/textArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/tooltipArgs.d.ts +4 -0
- package/dist/types/components/Chart/stories/args/types.d.ts +13 -0
- package/dist/types/components/Chart/stories/args/xAxisArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/yAxisArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/examples/AreaChart.d.ts +16 -0
- package/dist/types/components/Chart/stories/examples/BarChart.d.ts +20 -0
- package/dist/types/components/Chart/stories/examples/LineChart.d.ts +16 -0
- package/dist/types/components/Chart/stories/examples/PieChart.d.ts +19 -0
- package/dist/types/components/Chart/stories/examples/RadarChart.d.ts +24 -0
- package/dist/types/components/Chart/stories/examples/RadialChart.d.ts +17 -0
- package/dist/types/components/Chart/stories/examples/Tooltip.d.ts +15 -0
- package/dist/types/components/Chart/stories/helpers/index.d.ts +9 -0
- package/dist/types/components/Chart/types.d.ts +37 -0
- package/dist/types/components/DatetimePicker/DatetimeGrid.d.ts +26 -0
- package/dist/types/components/DatetimePicker/DatetimePicker.d.ts +13 -0
- package/dist/types/components/DatetimePicker/constants.d.ts +15 -0
- package/dist/types/components/DatetimePicker/index.d.ts +1 -0
- package/dist/types/components/DatetimePicker/types.d.ts +25 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeCalendar.d.ts +5 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +83 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInputContext.d.ts +2 -0
- package/dist/types/components/Form/DatetimeInput/NaturalLanguageInput.d.ts +5 -0
- package/dist/types/components/Form/DatetimeInput/TimePicker.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/constants.d.ts +24 -0
- package/dist/types/components/Form/DatetimeInput/helpers.d.ts +27 -0
- package/dist/types/components/Form/DatetimeInput/hooks/index.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/hooks/useDateInput/index.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/hooks/useDateInput/useDateInput.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/index.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/types.d.ts +31 -0
- package/dist/types/components/Form/MultiSelect/MultiSelect.d.ts +46 -0
- package/dist/types/components/Form/MultiSelect/MultiSelectContext.d.ts +2 -0
- package/dist/types/components/Form/MultiSelect/constants.d.ts +19 -0
- package/dist/types/components/Form/MultiSelect/hooks/index.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/hooks/useMultiSelect/index.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/hooks/useMultiSelect/useMultiSelect.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/index.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/types.d.ts +31 -0
- package/dist/types/components/Form/TagsInput/TagsInput.d.ts +13 -0
- package/dist/types/components/Form/TagsInput/constants.d.ts +16 -0
- package/dist/types/components/Form/TagsInput/index.d.ts +1 -0
- package/dist/types/components/Form/TagsInput/types.d.ts +9 -0
- package/dist/types/components/Form/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +7 -3
- package/src/components/Chart/Chart.tsx +26 -0
- package/src/components/Chart/ChartContext.tsx +4 -0
- package/src/components/Chart/components/ChartLegend.tsx +52 -0
- package/src/components/Chart/components/ChartStyle.tsx +32 -0
- package/src/components/Chart/components/ChartTooltip.tsx +126 -0
- package/src/components/Chart/components/index.ts +3 -0
- package/src/components/Chart/constants.ts +78 -0
- package/src/components/Chart/helpers.ts +27 -0
- package/src/components/Chart/hooks/index.ts +1 -0
- package/src/components/Chart/hooks/useChart/index.ts +1 -0
- package/src/components/Chart/hooks/useChart/useChart.ts +12 -0
- package/src/components/Chart/index.ts +2 -0
- package/src/components/Chart/stories/args/activeShapeArgs.ts +34 -0
- package/src/components/Chart/stories/args/animationArgs.ts +67 -0
- package/src/components/Chart/stories/args/areaArgs.ts +16 -0
- package/src/components/Chart/stories/args/areaChartArgs.ts +19 -0
- package/src/components/Chart/stories/args/barArgs.ts +123 -0
- package/src/components/Chart/stories/args/barChartArgs.ts +65 -0
- package/src/components/Chart/stories/args/cartesianChartArgs.ts +42 -0
- package/src/components/Chart/stories/args/cartesianSharedArgs.ts +136 -0
- package/src/components/Chart/stories/args/chartArgs.ts +244 -0
- package/src/components/Chart/stories/args/dotArgs.ts +46 -0
- package/src/components/Chart/stories/args/events.ts +343 -0
- package/src/components/Chart/stories/args/index.ts +178 -0
- package/src/components/Chart/stories/args/labelListArgs.ts +124 -0
- package/src/components/Chart/stories/args/legendArgs.ts +205 -0
- package/src/components/Chart/stories/args/lineArgs.ts +87 -0
- package/src/components/Chart/stories/args/lineChartArgs.ts +17 -0
- package/src/components/Chart/stories/args/pieArgs.ts +18 -0
- package/src/components/Chart/stories/args/pieChartArgs.ts +7 -0
- package/src/components/Chart/stories/args/polarChartArgs.ts +86 -0
- package/src/components/Chart/stories/args/polarSharedArgs.ts +42 -0
- package/src/components/Chart/stories/args/radarArgs.ts +26 -0
- package/src/components/Chart/stories/args/radarChartArgs.ts +26 -0
- package/src/components/Chart/stories/args/radialBarArgs.ts +36 -0
- package/src/components/Chart/stories/args/radialBarChartArgs.ts +16 -0
- package/src/components/Chart/stories/args/rectangleArgs.ts +35 -0
- package/src/components/Chart/stories/args/referenceSharedArgs.ts +75 -0
- package/src/components/Chart/stories/args/sectorArgs.ts +106 -0
- package/src/components/Chart/stories/args/sharedAxisArgs.ts +332 -0
- package/src/components/Chart/stories/args/stylesArgs.ts +258 -0
- package/src/components/Chart/stories/args/textArgs.ts +97 -0
- package/src/components/Chart/stories/args/tooltipArgs.ts +41 -0
- package/src/components/Chart/stories/args/types.ts +23 -0
- package/src/components/Chart/stories/args/xAxisArgs.ts +109 -0
- package/src/components/Chart/stories/args/yAxisArgs.ts +73 -0
- package/src/components/Chart/stories/examples/AreaChart.tsx +156 -0
- package/src/components/Chart/stories/examples/BarChart.tsx +425 -0
- package/src/components/Chart/stories/examples/LineChart.tsx +144 -0
- package/src/components/Chart/stories/examples/PieChart.tsx +238 -0
- package/src/components/Chart/stories/examples/RadarChart.tsx +261 -0
- package/src/components/Chart/stories/examples/RadialChart.tsx +239 -0
- package/src/components/Chart/stories/examples/Tooltip.tsx +68 -0
- package/src/components/Chart/stories/helpers/index.tsx +75 -0
- package/src/components/Chart/types.ts +39 -0
- package/src/components/DatetimePicker/DatetimeGrid.tsx +59 -0
- package/src/components/DatetimePicker/DatetimePicker.tsx +59 -0
- package/src/components/DatetimePicker/constants.ts +102 -0
- package/src/components/DatetimePicker/index.ts +1 -0
- package/src/components/DatetimePicker/types.ts +36 -0
- package/src/components/Form/DatetimeInput/DatetimeCalendar.tsx +68 -0
- package/src/components/Form/DatetimeInput/DatetimeInput.tsx +90 -0
- package/src/components/Form/DatetimeInput/DatetimeInputContext.tsx +4 -0
- package/src/components/Form/DatetimeInput/NaturalLanguageInput.tsx +73 -0
- package/src/components/Form/DatetimeInput/TimePicker.tsx +202 -0
- package/src/components/Form/DatetimeInput/constants.ts +135 -0
- package/src/components/Form/DatetimeInput/helpers.ts +93 -0
- package/src/components/Form/DatetimeInput/hooks/index.ts +1 -0
- package/src/components/Form/DatetimeInput/hooks/useDateInput/index.ts +1 -0
- package/src/components/Form/DatetimeInput/hooks/useDateInput/useDateInput.ts +10 -0
- package/src/components/Form/DatetimeInput/index.ts +1 -0
- package/src/components/Form/DatetimeInput/types.ts +36 -0
- package/src/components/Form/MultiSelect/MultiSelect.tsx +348 -0
- package/src/components/Form/MultiSelect/MultiSelectContext.tsx +4 -0
- package/src/components/Form/MultiSelect/constants.ts +103 -0
- package/src/components/Form/MultiSelect/hooks/index.ts +1 -0
- package/src/components/Form/MultiSelect/hooks/useMultiSelect/index.ts +1 -0
- package/src/components/Form/MultiSelect/hooks/useMultiSelect/useMultiSelect.ts +10 -0
- package/src/components/Form/MultiSelect/index.ts +1 -0
- package/src/components/Form/MultiSelect/types.ts +46 -0
- package/src/components/Form/TagsInput/TagsInput.tsx +278 -0
- package/src/components/Form/TagsInput/constants.ts +87 -0
- package/src/components/Form/TagsInput/index.ts +1 -0
- package/src/components/Form/TagsInput/types.ts +10 -0
- package/src/components/Form/index.ts +2 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Item, MultiSelectContentProps, MultiSelectInputProps, MultiSelectProps, MultiSelectTriggerProps } from './types';
|
|
2
|
+
declare const MultiSelect: {
|
|
3
|
+
({ values, onValuesChange, loop, className, children, dir, ...props }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Trigger: {
|
|
5
|
+
({ className, children, size, wide, outline, variant, disabled, ...props }: MultiSelectTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
Input: {
|
|
9
|
+
({ className, ...props }: MultiSelectInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
Content: import('react').ForwardRefExoticComponent<MultiSelectContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
13
|
+
List: import('react').ForwardRefExoticComponent<Omit<Omit<{
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
} & Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
16
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
17
|
+
} & {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
}, "asChild" | "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
20
|
+
label?: string;
|
|
21
|
+
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
22
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
23
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
24
|
+
Item: import('react').ForwardRefExoticComponent<Item & Omit<Omit<{
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
} & Omit<Pick<Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
27
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
28
|
+
} & {
|
|
29
|
+
asChild?: boolean;
|
|
30
|
+
}, "asChild" | "key" | keyof import('react').HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
onSelect?: (value: string) => void;
|
|
33
|
+
value?: string;
|
|
34
|
+
keywords?: string[];
|
|
35
|
+
forceMount?: boolean;
|
|
36
|
+
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
37
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
38
|
+
disabled?: boolean | undefined;
|
|
39
|
+
included?: boolean | undefined;
|
|
40
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
41
|
+
};
|
|
42
|
+
export declare const MultiSelectTrigger: {
|
|
43
|
+
({ className, children, size, wide, outline, variant, disabled, ...props }: MultiSelectTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
export { MultiSelect };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const getMultiSelectClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
2
|
+
export declare const getMultiSelectTriggerClasses: (props?: ({
|
|
3
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | "ghost" | null | undefined;
|
|
4
|
+
outline?: boolean | null | undefined;
|
|
5
|
+
disabled?: boolean | null | undefined;
|
|
6
|
+
wide?: boolean | null | undefined;
|
|
7
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
8
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
|
+
export declare const getMultiSelectItemClasses: (props?: ({
|
|
10
|
+
included?: boolean | null | undefined;
|
|
11
|
+
disabled?: boolean | null | undefined;
|
|
12
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
14
|
+
export declare const getMultiSelectListClasses: (props?: ({
|
|
15
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
16
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
17
|
+
export declare const getMultiSelectTagClasses: (props?: ({
|
|
18
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
19
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useMultiSelect } from './useMultiSelect';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useMultiSelect } from './useMultiSelect';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useMultiSelect: () => import('../../types').MultiSelectContextProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MultiSelect } from './MultiSelect';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, HTMLAttributes } from 'react';
|
|
2
|
+
import { VariantProps } from '../../../libs';
|
|
3
|
+
import { Command } from '../../Command';
|
|
4
|
+
import { getMultiSelectItemClasses, getMultiSelectListClasses, getMultiSelectTriggerClasses } from './constants';
|
|
5
|
+
export type Item = {
|
|
6
|
+
value: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
};
|
|
9
|
+
export type MultiSelectProps = React.ComponentPropsWithoutRef<typeof Command> & {
|
|
10
|
+
loop?: boolean;
|
|
11
|
+
values: Item["value"][];
|
|
12
|
+
onValuesChange: (value: string[]) => void;
|
|
13
|
+
};
|
|
14
|
+
export type MultiSelectContextProps = {
|
|
15
|
+
values: Item["value"][];
|
|
16
|
+
onValueChange: (value: Item["value"], label?: Item["label"]) => void;
|
|
17
|
+
items: Item[];
|
|
18
|
+
open: boolean;
|
|
19
|
+
setOpen: (value: boolean) => void;
|
|
20
|
+
inputValue: string;
|
|
21
|
+
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
22
|
+
activeIndex: number;
|
|
23
|
+
setActiveIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
24
|
+
ref: React.RefObject<HTMLInputElement>;
|
|
25
|
+
handleSelect: (e: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
26
|
+
};
|
|
27
|
+
export type MultiSelectTriggerProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof getMultiSelectTriggerClasses>;
|
|
28
|
+
export type MultiSelectInputProps = ComponentPropsWithoutRef<typeof Command.Input>;
|
|
29
|
+
export type MultiSelectContentProps = HTMLAttributes<HTMLDivElement>;
|
|
30
|
+
export type MultiSelectListProps = ComponentPropsWithoutRef<typeof Command.List> & VariantProps<typeof getMultiSelectListClasses>;
|
|
31
|
+
export type MultiSelectItemProps = Item & ComponentPropsWithoutRef<typeof Command.Item> & VariantProps<typeof getMultiSelectItemClasses>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const TagsInput: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & {
|
|
2
|
+
defaultTags?: string[];
|
|
3
|
+
onChange?: (value: string[], inputValue: string) => void;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
maxItems?: number;
|
|
6
|
+
minItems?: number;
|
|
7
|
+
} & {
|
|
8
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | "ghost" | undefined;
|
|
9
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
10
|
+
outline?: boolean | undefined;
|
|
11
|
+
wide?: boolean | undefined;
|
|
12
|
+
disabled?: boolean | undefined;
|
|
13
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const SPLITTER_REGEX: RegExp;
|
|
2
|
+
export declare const FORMATTING_REGEX: RegExp;
|
|
3
|
+
export declare const getTagsClasses: (props?: ({
|
|
4
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | "ghost" | null | undefined;
|
|
5
|
+
outline?: boolean | null | undefined;
|
|
6
|
+
disabled?: boolean | null | undefined;
|
|
7
|
+
wide?: boolean | null | undefined;
|
|
8
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export declare const getTagClasses: (props?: ({
|
|
11
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
12
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
13
|
+
export declare const getTagsInputClasses: (props?: ({
|
|
14
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
15
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
16
|
+
export declare const getTagDeleteClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TagsInput } from './TagsInput';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VariantProps } from '../../../libs';
|
|
2
|
+
import { getTagsClasses } from './constants';
|
|
3
|
+
export type TagsInputProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
defaultTags?: string[];
|
|
5
|
+
onChange?: (value: string[], inputValue: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
maxItems?: number;
|
|
8
|
+
minItems?: number;
|
|
9
|
+
} & VariantProps<typeof getTagsClasses>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { DatetimeInput } from './DatetimeInput';
|
|
1
2
|
export { Input } from './Input';
|
|
2
3
|
export { OtpInput } from './OtpInput';
|
|
3
4
|
export { Phone } from './Phone';
|
|
@@ -7,6 +8,7 @@ export { Select } from './Select';
|
|
|
7
8
|
export { Slider } from './Slider';
|
|
8
9
|
export { Switch } from './Switch';
|
|
9
10
|
export { Checkbox } from './Checkbox';
|
|
11
|
+
export { TagsInput } from './TagsInput';
|
|
10
12
|
export { Textarea } from './Textarea';
|
|
11
13
|
export { TextField } from './TextField';
|
|
12
14
|
export { Label } from './components/Label';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './components/Table';
|
|
|
24
24
|
export * from './components/Tabs';
|
|
25
25
|
export * from './components/Text';
|
|
26
26
|
/** data input */
|
|
27
|
+
export * from './components/DatetimePicker';
|
|
27
28
|
export * from './components/FileUploader';
|
|
28
29
|
export * from './components/Form';
|
|
29
30
|
export * from './components/Combobox';
|
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.45",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dev": "storybook dev -p 6006",
|
|
54
54
|
"build": "tsc && vite build",
|
|
55
55
|
"build-storybook": "storybook build -o ../../docs/storybook/common",
|
|
56
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings
|
|
56
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 30",
|
|
57
57
|
"prettier": "prettier --check \"**/*.{ts,tsx}\"",
|
|
58
58
|
"prettier:write": "prettier --write \"**/*.{ts,tsx}\"",
|
|
59
59
|
"preview": "vite preview",
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
"@radix-ui/react-toggle-group": "^1.1.0",
|
|
94
94
|
"@radix-ui/react-tooltip": "^1.1.2",
|
|
95
95
|
"@tailwindcss/typography": "^0.5.15",
|
|
96
|
+
"chrono-node": "^2.7.7",
|
|
96
97
|
"class-variance-authority": "^0.7.0",
|
|
97
98
|
"clsx": "^2.1.1",
|
|
98
99
|
"cmdk": "^1.0.0",
|
|
@@ -101,6 +102,7 @@
|
|
|
101
102
|
"react-dropzone": "^14.2.3",
|
|
102
103
|
"react-international-phone": "^4.3.0",
|
|
103
104
|
"react-otp-input": "^3.1.1",
|
|
105
|
+
"recharts": "^2.12.7",
|
|
104
106
|
"sonner": "^1.5.0",
|
|
105
107
|
"tailwind-merge": "^2.5.2",
|
|
106
108
|
"tailwindcss-animate": "^1.0.7",
|
|
@@ -115,6 +117,7 @@
|
|
|
115
117
|
"@storybook/addon-interactions": "^8.3.4",
|
|
116
118
|
"@storybook/addon-links": "^8.3.4",
|
|
117
119
|
"@storybook/addon-onboarding": "^8.3.4",
|
|
120
|
+
"@storybook/addon-storysource": "^8.3.4",
|
|
118
121
|
"@storybook/addon-themes": "^8.3.4",
|
|
119
122
|
"@storybook/addon-viewport": "^8.3.4",
|
|
120
123
|
"@storybook/blocks": "^8.3.4",
|
|
@@ -153,6 +156,7 @@
|
|
|
153
156
|
"react-router-dom": "^6.26.2",
|
|
154
157
|
"storybook": "^8.3.4",
|
|
155
158
|
"tailwindcss": "^3.4.13",
|
|
159
|
+
"timescape": "^0.5.2",
|
|
156
160
|
"typescript": "^5.6.2",
|
|
157
161
|
"vite": "^5.4.8",
|
|
158
162
|
"vite-plugin-dts": "^4.2.2",
|
|
@@ -163,5 +167,5 @@
|
|
|
163
167
|
"react-dom": "^18.2.0",
|
|
164
168
|
"typescript": "^5.2.2"
|
|
165
169
|
},
|
|
166
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "097691180db90aaf22c9557d1f2f919246b167c1"
|
|
167
171
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useId } from "react";
|
|
4
|
+
import { ResponsiveContainer } from "recharts";
|
|
5
|
+
import { cn } from "../../utilities";
|
|
6
|
+
import { ChartContext } from "./ChartContext";
|
|
7
|
+
import { ChartStyle } from "./components";
|
|
8
|
+
import { getChartClasses } from "./constants";
|
|
9
|
+
import { type ChartProps } from "./types";
|
|
10
|
+
|
|
11
|
+
export const Chart = forwardRef<HTMLDivElement, ChartProps>(
|
|
12
|
+
({ id, className, children, config, ...props }, ref) => {
|
|
13
|
+
const uniqueId = useId();
|
|
14
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<ChartContext.Provider value={{ config }}>
|
|
18
|
+
<div ref={ref} data-chart={chartId} className={cn(getChartClasses(), className)} {...props}>
|
|
19
|
+
<ChartStyle id={chartId} config={config} />
|
|
20
|
+
<ResponsiveContainer>{children}</ResponsiveContainer>
|
|
21
|
+
</div>
|
|
22
|
+
</ChartContext.Provider>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
Chart.displayName = "Chart";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { Legend } from "recharts";
|
|
5
|
+
import type { ChartLegendContentProps } from "../types";
|
|
6
|
+
import { cn } from "../../../utilities";
|
|
7
|
+
import {
|
|
8
|
+
getChartLegendContainerClasses,
|
|
9
|
+
getChartLegendItemClasses,
|
|
10
|
+
getChartLegendMarkerClasses,
|
|
11
|
+
} from "../constants";
|
|
12
|
+
import { getPayloadConfigFromPayload } from "../helpers";
|
|
13
|
+
import { useChart } from "../hooks";
|
|
14
|
+
|
|
15
|
+
export const ChartLegend = Legend;
|
|
16
|
+
ChartLegend.displayName = "ChartLegend";
|
|
17
|
+
|
|
18
|
+
export const ChartLegendContent = forwardRef<HTMLDivElement, ChartLegendContentProps>(
|
|
19
|
+
({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
20
|
+
const { config } = useChart();
|
|
21
|
+
|
|
22
|
+
if (!payload?.length) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div ref={ref} className={cn(getChartLegendContainerClasses({ verticalAlign }), className)}>
|
|
28
|
+
{payload.map((item) => {
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
30
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
31
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
35
|
+
<div key={item.value} className={getChartLegendItemClasses()}>
|
|
36
|
+
{itemConfig?.icon && !hideIcon ? (
|
|
37
|
+
<itemConfig.icon />
|
|
38
|
+
) : (
|
|
39
|
+
<div
|
|
40
|
+
style={{ backgroundColor: item.color }}
|
|
41
|
+
className={getChartLegendMarkerClasses()}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
{itemConfig?.label}
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
})}
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
ChartLegendContent.displayName = "ChartLegendContent";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Theme } from "../../../utilities";
|
|
2
|
+
import { THEMES } from "../constants";
|
|
3
|
+
import { type ChartStyleProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export const ChartStyle = ({ id, config }: ChartStyleProps) => {
|
|
6
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme || config.color);
|
|
7
|
+
|
|
8
|
+
if (!colorConfig.length) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<style
|
|
14
|
+
dangerouslySetInnerHTML={{
|
|
15
|
+
__html: Object.entries(THEMES)
|
|
16
|
+
.map(
|
|
17
|
+
([theme, prefix]) => `
|
|
18
|
+
${prefix} [data-chart=${id}] {
|
|
19
|
+
${colorConfig
|
|
20
|
+
.map(([key, itemConfig]) => {
|
|
21
|
+
const color = itemConfig.theme?.[theme as Theme] || itemConfig.color;
|
|
22
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
23
|
+
})
|
|
24
|
+
.join("\n")}
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
)
|
|
28
|
+
.join("\n"),
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useMemo } from "react";
|
|
4
|
+
import { Tooltip } from "recharts";
|
|
5
|
+
import type { ChartTooltipContentProps } from "../types";
|
|
6
|
+
import { cn } from "../../../utilities";
|
|
7
|
+
import {
|
|
8
|
+
getChartTooltipContainerClasses,
|
|
9
|
+
getChartTooltipItemClasses,
|
|
10
|
+
getChartTooltipItemIndicatorClasses,
|
|
11
|
+
getChartTooltipItemLabelClasses,
|
|
12
|
+
getChartTooltipItemValueClasses,
|
|
13
|
+
} from "../constants";
|
|
14
|
+
import { getPayloadConfigFromPayload } from "../helpers";
|
|
15
|
+
import { useChart } from "../hooks";
|
|
16
|
+
|
|
17
|
+
export const ChartTooltip = Tooltip;
|
|
18
|
+
ChartTooltip.displayName = "ChartTooltip";
|
|
19
|
+
|
|
20
|
+
export const ChartTooltipContent = forwardRef<HTMLDivElement, ChartTooltipContentProps>(
|
|
21
|
+
(
|
|
22
|
+
{
|
|
23
|
+
active,
|
|
24
|
+
payload,
|
|
25
|
+
className,
|
|
26
|
+
indicator = "dot",
|
|
27
|
+
hideLabel = false,
|
|
28
|
+
hideIndicator = false,
|
|
29
|
+
label,
|
|
30
|
+
labelFormatter,
|
|
31
|
+
labelClassName,
|
|
32
|
+
formatter,
|
|
33
|
+
color,
|
|
34
|
+
nameKey,
|
|
35
|
+
labelKey,
|
|
36
|
+
},
|
|
37
|
+
ref
|
|
38
|
+
) => {
|
|
39
|
+
const { config } = useChart();
|
|
40
|
+
|
|
41
|
+
const tooltipLabel = useMemo(() => {
|
|
42
|
+
if (hideLabel || !payload?.length) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const [item] = payload;
|
|
47
|
+
const key = `${labelKey || item.dataKey || item.name || "value"}`;
|
|
48
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
49
|
+
const value =
|
|
50
|
+
!labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
51
|
+
|
|
52
|
+
if (labelFormatter) {
|
|
53
|
+
return (
|
|
54
|
+
<div className={cn("font-medium", labelClassName)}>{labelFormatter(value, payload)}</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!value) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return <div className={cn("font-medium", labelClassName)}>{value}</div>;
|
|
63
|
+
}, [label, labelFormatter, payload, hideLabel, labelClassName, config, labelKey]);
|
|
64
|
+
|
|
65
|
+
if (!active || !payload?.length) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div ref={ref} className={cn(getChartTooltipContainerClasses(), className)}>
|
|
73
|
+
{!nestLabel ? tooltipLabel : null}
|
|
74
|
+
<div className="grid gap-1.5">
|
|
75
|
+
{payload.map((item, index) => {
|
|
76
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
77
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
78
|
+
const indicatorColor =
|
|
79
|
+
color ||
|
|
80
|
+
(item.payload as { fill: string }).fill ||
|
|
81
|
+
item.color ||
|
|
82
|
+
(item as { fill: string }).fill;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div key={item.dataKey} className={getChartTooltipItemClasses({ indicator })}>
|
|
86
|
+
{formatter && item?.value !== undefined && item.name ? (
|
|
87
|
+
formatter(item.value, item.name, item, index, payload)
|
|
88
|
+
) : (
|
|
89
|
+
<>
|
|
90
|
+
{itemConfig?.icon ? (
|
|
91
|
+
<itemConfig.icon />
|
|
92
|
+
) : (
|
|
93
|
+
!hideIndicator && (
|
|
94
|
+
<div
|
|
95
|
+
className={getChartTooltipItemIndicatorClasses({ indicator, nestLabel })}
|
|
96
|
+
style={
|
|
97
|
+
{
|
|
98
|
+
"--color-bg": indicatorColor,
|
|
99
|
+
"--color-border": indicatorColor,
|
|
100
|
+
} as React.CSSProperties
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
)
|
|
104
|
+
)}
|
|
105
|
+
<div className={getChartTooltipItemLabelClasses({ nestLabel })}>
|
|
106
|
+
<div className="grid gap-1.5">
|
|
107
|
+
{nestLabel ? tooltipLabel : null}
|
|
108
|
+
<span>{itemConfig?.label || item.name}</span>
|
|
109
|
+
</div>
|
|
110
|
+
{item.value && (
|
|
111
|
+
<span className={getChartTooltipItemValueClasses()}>
|
|
112
|
+
{item.value.toLocaleString()}
|
|
113
|
+
</span>
|
|
114
|
+
)}
|
|
115
|
+
</div>
|
|
116
|
+
</>
|
|
117
|
+
)}
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
})}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
ChartTooltipContent.displayName = "ChartTooltipContent";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { Theme } from "../../utilities";
|
|
2
|
+
import { cva } from "../../libs";
|
|
3
|
+
|
|
4
|
+
export const THEMES = {
|
|
5
|
+
light: "",
|
|
6
|
+
dark: ".dark",
|
|
7
|
+
} satisfies Record<Theme, string>;
|
|
8
|
+
|
|
9
|
+
export const getChartClasses = cva(
|
|
10
|
+
"flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-base-content [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-base-content/20 [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-radial-bar-background-sector]:fill-base-200 [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-base-200 [&_.recharts-reference-line_[stroke='#ccc']]:stroke-base-content/20 [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none"
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
export const getChartLegendContainerClasses = cva("flex items-center justify-center gap-4", {
|
|
14
|
+
variants: {
|
|
15
|
+
verticalAlign: {
|
|
16
|
+
top: "pb-3",
|
|
17
|
+
bottom: "pt-3",
|
|
18
|
+
middle: "",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const getChartLegendItemClasses = cva("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3");
|
|
24
|
+
|
|
25
|
+
export const getChartLegendMarkerClasses = cva("h-2 w-2 shrink-0 rounded-[2px]");
|
|
26
|
+
|
|
27
|
+
export const getChartTooltipContainerClasses = cva(
|
|
28
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-md border border-border/50 bg-base-100 px-2.5 py-1.5 text-xs shadow-xl"
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const getChartTooltipItemClasses = cva(
|
|
32
|
+
"flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-base-content",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
indicator: {
|
|
36
|
+
dot: "items-center",
|
|
37
|
+
line: "",
|
|
38
|
+
dashed: "",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export const getChartTooltipItemLabelClasses = cva(
|
|
45
|
+
"flex flex-1 justify-between leading-none items-center",
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
nestLabel: {
|
|
49
|
+
true: "items-end",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const getChartTooltipItemValueClasses = cva("font-mono font-medium tabular-nums");
|
|
56
|
+
|
|
57
|
+
export const getChartTooltipItemIndicatorClasses = cva(
|
|
58
|
+
"shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
indicator: {
|
|
62
|
+
dot: "h-2.5 w-2.5",
|
|
63
|
+
line: "w-1",
|
|
64
|
+
dashed: "w-0 border-[1.5px] border-dashed bg-transparent",
|
|
65
|
+
},
|
|
66
|
+
nestLabel: {
|
|
67
|
+
true: "",
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
compoundVariants: [
|
|
71
|
+
{
|
|
72
|
+
indicator: "dashed",
|
|
73
|
+
nestLabel: true,
|
|
74
|
+
className: "my-0.5",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ChartConfig } from "./types";
|
|
2
|
+
|
|
3
|
+
// Helper to extract item config from a payload.
|
|
4
|
+
export const getPayloadConfigFromPayload = (config: ChartConfig, payload: unknown, key: string) => {
|
|
5
|
+
if (typeof payload !== "object" || payload === null) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const payloadPayload =
|
|
10
|
+
"payload" in payload && typeof payload.payload === "object" && payload.payload !== null
|
|
11
|
+
? payload.payload
|
|
12
|
+
: undefined;
|
|
13
|
+
|
|
14
|
+
let configLabelKey: string = key;
|
|
15
|
+
|
|
16
|
+
if (key in payload && typeof payload[key as keyof typeof payload] === "string") {
|
|
17
|
+
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;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChart } from "./useChart";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChart } from "./useChart";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { ChartContext } from "../../ChartContext";
|
|
3
|
+
|
|
4
|
+
export const useChart = () => {
|
|
5
|
+
const context = useContext(ChartContext);
|
|
6
|
+
|
|
7
|
+
if (!context) {
|
|
8
|
+
throw new Error("useChart must be used within a <Chart />");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ArgTypes } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
export const activeShapeArgs: ArgTypes = {
|
|
4
|
+
activeIndex: {
|
|
5
|
+
description:
|
|
6
|
+
"The index of the individual shapes of the graph element to be marked as active, and render props.activeShape",
|
|
7
|
+
table: {
|
|
8
|
+
category: "General",
|
|
9
|
+
},
|
|
10
|
+
control: "number",
|
|
11
|
+
},
|
|
12
|
+
shape: {
|
|
13
|
+
description: "The customized shape to be rendered.",
|
|
14
|
+
table: {
|
|
15
|
+
type: {
|
|
16
|
+
summary: "Function | boolean | ReactElement | object",
|
|
17
|
+
},
|
|
18
|
+
defaultValue: undefined,
|
|
19
|
+
category: "General",
|
|
20
|
+
},
|
|
21
|
+
control: "object",
|
|
22
|
+
},
|
|
23
|
+
activeShape: {
|
|
24
|
+
description: "The customized shape to be rendered if activeIndex or activeTooltipIndex match",
|
|
25
|
+
table: {
|
|
26
|
+
type: {
|
|
27
|
+
summary: "Function | boolean | ReactElement | object",
|
|
28
|
+
},
|
|
29
|
+
defaultValue: undefined,
|
|
30
|
+
category: "General",
|
|
31
|
+
},
|
|
32
|
+
control: "object",
|
|
33
|
+
},
|
|
34
|
+
};
|