@mbao01/common 0.0.56 → 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.
- package/dist/types/components/Chart/stories/examples/Tooltip.d.ts +0 -13
- package/dist/types/components/Chart/stories/helpers/index.d.ts +2 -2
- package/dist/types/components/DatePicker/types.d.ts +3 -3
- package/dist/types/components/DatetimePicker/constants.d.ts +1 -1
- package/dist/types/components/DragAndDrop/Draggable/types.d.ts +1 -1
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +14 -10
- package/dist/types/components/Form/MultiSelect/MultiSelect.d.ts +2 -1
- package/dist/types/components/Form/MultiSelect/constants.d.ts +5 -1
- package/dist/types/components/Form/MultiSelect/types.d.ts +3 -3
- package/dist/types/components/Form/Select/constants.d.ts +3 -0
- package/dist/types/components/Form/Select/types.d.ts +2 -1
- package/dist/types/components/Form/components/FormControl/types.d.ts +1 -1
- package/dist/types/components/Text/types.d.ts +1 -1
- package/dist/types/components/ThemeSwitch/types.d.ts +1 -1
- package/dist/types/components/Timeline/Timeline.d.ts +1 -1
- package/package.json +92 -88
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/Chart/components/ChartLegend.tsx +1 -3
- package/src/components/Chart/components/ChartStyle.tsx +2 -2
- package/src/components/Chart/components/ChartTooltip.tsx +9 -7
- package/src/components/Chart/stories/args/types.ts +1 -0
- package/src/components/Chart/stories/examples/RadialChart.tsx +4 -4
- package/src/components/Chart/stories/examples/Tooltip.tsx +1 -1
- package/src/components/Chart/stories/helpers/index.tsx +3 -3
- package/src/components/Chart/types.ts +1 -0
- package/src/components/DatePicker/types.ts +3 -3
- package/src/components/DragAndDrop/Draggable/types.ts +1 -1
- package/src/components/DragAndDrop/Droppable/Droppable.tsx +1 -1
- package/src/components/Form/MultiSelect/MultiSelect.tsx +7 -6
- package/src/components/Form/MultiSelect/constants.ts +25 -7
- package/src/components/Form/MultiSelect/types.ts +4 -2
- package/src/components/Form/Phone/Phone.tsx +1 -1
- package/src/components/Form/Select/constants.ts +12 -1
- package/src/components/Form/Select/types.ts +8 -1
- package/src/components/Form/components/FormControl/types.ts +1 -1
- package/src/components/Text/types.ts +1 -1
- package/src/components/ThemeSwitch/types.ts +1 -1
|
@@ -1,15 +1,2 @@
|
|
|
1
1
|
import { ChartTooltipContentProps } from '../../types';
|
|
2
|
-
export declare const tooltipChartConfig: {
|
|
3
|
-
activities: {
|
|
4
|
-
label: string;
|
|
5
|
-
};
|
|
6
|
-
running: {
|
|
7
|
-
label: string;
|
|
8
|
-
color: string;
|
|
9
|
-
};
|
|
10
|
-
swimming: {
|
|
11
|
-
label: string;
|
|
12
|
-
color: string;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
2
|
export declare const BarChartExample: (props: ChartTooltipContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ArgTypes, StoryContext
|
|
1
|
+
import { ArgTypes, StoryContext } from '@storybook/react';
|
|
2
2
|
import { ElementType } from 'react';
|
|
3
3
|
export declare const categorizeArgs: (args: ArgTypes, category: string) => ArgTypes<import('@storybook/react').Args>;
|
|
4
|
-
export declare const withArgs: <T extends object>(Component:
|
|
4
|
+
export declare const withArgs: <T extends object>(Component: React.FC, context: StoryContext<T>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const getArgsFromArgTypes: <T extends ArgTypes>(argsTypes: T) => Record<keyof T, unknown>;
|
|
6
6
|
export declare const renderer: <T extends ElementType>(Component: T) => {
|
|
7
7
|
<G>(props: G): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,7 +8,7 @@ export type DatePickerProps = BaseDatePickerProps & Omit<PropsSingle, "mode"> &
|
|
|
8
8
|
children?: ({ date, setDate, }: {
|
|
9
9
|
date: Date | undefined;
|
|
10
10
|
setDate: React.Dispatch<React.SetStateAction<Date | undefined>>;
|
|
11
|
-
}) => JSX.Element | null;
|
|
11
|
+
}) => React.JSX.Element | null;
|
|
12
12
|
defaultDate?: Date;
|
|
13
13
|
getDateLabel?: (date: Date | undefined) => string | undefined;
|
|
14
14
|
getDateValue?: (date: Date | undefined) => string | undefined;
|
|
@@ -19,11 +19,11 @@ export type DateRangePickerProps = BaseDatePickerProps & Omit<PropsRange, "mode"
|
|
|
19
19
|
from: string | undefined;
|
|
20
20
|
to: string | undefined;
|
|
21
21
|
};
|
|
22
|
-
getRangeLabel?: (range: DateRange | undefined) => string | JSX.Element | undefined;
|
|
22
|
+
getRangeLabel?: (range: DateRange | undefined) => string | React.JSX.Element | undefined;
|
|
23
23
|
};
|
|
24
24
|
export type MultipleDatesPickerProps = BaseDatePickerProps & Omit<PropsMulti, "mode"> & {
|
|
25
25
|
defaultDates?: Date[];
|
|
26
26
|
getDatesValue?: (dates: Date[] | undefined) => string[] | undefined;
|
|
27
|
-
getDatesLabel?: (dates: Date[] | undefined) => string | JSX.Element | undefined;
|
|
27
|
+
getDatesLabel?: (dates: Date[] | undefined) => string | React.JSX.Element | undefined;
|
|
28
28
|
};
|
|
29
29
|
export {};
|
|
@@ -11,5 +11,5 @@ export declare const getDatetimeGridClasses: (props?: ({
|
|
|
11
11
|
export declare const getDatetimeSeparatorClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
12
12
|
export declare const getDatetimeInputClasses: (props?: ({
|
|
13
13
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
14
|
-
unit?: DateFormat | TimeFormat
|
|
14
|
+
unit?: Record<DateFormat | TimeFormat, string>;
|
|
15
15
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -6,7 +6,7 @@ export declare enum DraggableAxis {
|
|
|
6
6
|
Vertical = 1,
|
|
7
7
|
Horizontal = 2
|
|
8
8
|
}
|
|
9
|
-
export type DraggableHandleElement = JSX.Element | null;
|
|
9
|
+
export type DraggableHandleElement = React.JSX.Element | null;
|
|
10
10
|
export type DraggableActionsArgs = {
|
|
11
11
|
draggable: {
|
|
12
12
|
ref: Ref<HTMLElement> | undefined;
|
|
@@ -17,14 +17,16 @@ export declare const DatetimeInput: import('react').ForwardRefExoticComponent<{
|
|
|
17
17
|
hidden?: import('react-day-picker').Matcher | import('react-day-picker').Matcher[] | undefined;
|
|
18
18
|
id?: string | undefined;
|
|
19
19
|
lang?: HTMLDivElement["lang"] | undefined;
|
|
20
|
-
nonce?:
|
|
20
|
+
nonce?: string | undefined;
|
|
21
21
|
style?: React.CSSProperties | undefined;
|
|
22
22
|
title?: HTMLDivElement["title"] | undefined;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
role?: "application" | "dialog" | undefined | undefined;
|
|
24
|
+
"aria-label"?: string | undefined;
|
|
25
|
+
footer?: import('react').ReactNode;
|
|
25
26
|
month?: Date | undefined;
|
|
26
27
|
classNames?: (Partial<import('react-day-picker').ClassNames> & Partial<import('react-day-picker').DeprecatedUI<string>>) | undefined;
|
|
27
28
|
showOutsideDays?: boolean | undefined;
|
|
29
|
+
required?: boolean | undefined | undefined;
|
|
28
30
|
modifiersClassNames?: import('react-day-picker').ModifiersClassNames | undefined;
|
|
29
31
|
styles?: (Partial<import('react-day-picker').Styles> & Partial<import('react-day-picker').DeprecatedUI<React.CSSProperties>>) | undefined;
|
|
30
32
|
modifiersStyles?: import('react-day-picker').ModifiersStyles | undefined;
|
|
@@ -33,7 +35,7 @@ export declare const DatetimeInput: import('react').ForwardRefExoticComponent<{
|
|
|
33
35
|
startMonth?: Date | undefined;
|
|
34
36
|
fromDate?: Date | undefined;
|
|
35
37
|
fromMonth?: Date | undefined;
|
|
36
|
-
fromYear?: number | undefined;
|
|
38
|
+
fromYear?: number | undefined | undefined;
|
|
37
39
|
endMonth?: Date | undefined;
|
|
38
40
|
toDate?: Date | undefined;
|
|
39
41
|
toMonth?: Date | undefined;
|
|
@@ -42,22 +44,24 @@ export declare const DatetimeInput: import('react').ForwardRefExoticComponent<{
|
|
|
42
44
|
reverseMonths?: boolean | undefined;
|
|
43
45
|
hideNavigation?: boolean | undefined;
|
|
44
46
|
disableNavigation?: boolean | undefined;
|
|
45
|
-
captionLayout?:
|
|
47
|
+
captionLayout?: "label" | "dropdown" | "dropdown-months" | "dropdown-years" | undefined;
|
|
46
48
|
fixedWeeks?: boolean | undefined;
|
|
47
49
|
hideWeekdays?: boolean | undefined;
|
|
48
50
|
showWeekNumber?: boolean | undefined;
|
|
51
|
+
broadcastCalendar?: boolean | undefined;
|
|
49
52
|
ISOWeek?: boolean | undefined;
|
|
50
|
-
timeZone?: string | undefined;
|
|
53
|
+
timeZone?: string | undefined | undefined;
|
|
51
54
|
components?: Partial<import('react-day-picker').CustomComponents> | undefined;
|
|
55
|
+
initialFocus?: boolean | undefined;
|
|
52
56
|
today?: Date | undefined;
|
|
53
57
|
modifiers?: Record<string, import('react-day-picker').Matcher | import('react-day-picker').Matcher[] | undefined> | undefined;
|
|
54
58
|
labels?: Partial<import('react-day-picker').Labels> | undefined;
|
|
55
59
|
formatters?: Partial<import('react-day-picker').Formatters> | undefined;
|
|
56
60
|
locale?: Partial<import('date-fns').Locale> | undefined;
|
|
57
|
-
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
|
|
58
|
-
firstWeekContainsDate?:
|
|
59
|
-
useAdditionalWeekYearTokens?: boolean | undefined;
|
|
60
|
-
useAdditionalDayOfYearTokens?: boolean | undefined;
|
|
61
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined | undefined;
|
|
62
|
+
firstWeekContainsDate?: 1 | 4 | undefined;
|
|
63
|
+
useAdditionalWeekYearTokens?: boolean | undefined | undefined;
|
|
64
|
+
useAdditionalDayOfYearTokens?: boolean | undefined | undefined;
|
|
61
65
|
onMonthChange?: import('react-day-picker').MonthChangeEventHandler | undefined;
|
|
62
66
|
onNextClick?: import('react-day-picker').MonthChangeEventHandler | undefined;
|
|
63
67
|
onPrevClick?: import('react-day-picker').MonthChangeEventHandler | undefined;
|
|
@@ -6,7 +6,7 @@ declare const MultiSelect: {
|
|
|
6
6
|
displayName: string;
|
|
7
7
|
};
|
|
8
8
|
Input: {
|
|
9
|
-
({ className, ...props }: MultiSelectInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
({ className, size, ...props }: MultiSelectInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
Content: import('react').ForwardRefExoticComponent<MultiSelectContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -34,6 +34,7 @@ declare const MultiSelect: {
|
|
|
34
34
|
keywords?: string[];
|
|
35
35
|
forceMount?: boolean;
|
|
36
36
|
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
37
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
37
38
|
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
38
39
|
disabled?: boolean | undefined;
|
|
39
40
|
included?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const getMultiSelectClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
2
2
|
export declare const getMultiSelectTriggerClasses: (props?: ({
|
|
3
|
-
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
3
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
4
4
|
outline?: boolean | null | undefined;
|
|
5
5
|
disabled?: boolean | null | undefined;
|
|
6
6
|
wide?: boolean | null | undefined;
|
|
@@ -10,6 +10,7 @@ export declare const getMultiSelectItemClasses: (props?: ({
|
|
|
10
10
|
included?: boolean | null | undefined;
|
|
11
11
|
disabled?: boolean | null | undefined;
|
|
12
12
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
13
14
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
14
15
|
export declare const getMultiSelectListClasses: (props?: ({
|
|
15
16
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
@@ -17,3 +18,6 @@ export declare const getMultiSelectListClasses: (props?: ({
|
|
|
17
18
|
export declare const getMultiSelectTagClasses: (props?: ({
|
|
18
19
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
19
20
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
21
|
+
export declare const getMultiSelectInputClasses: (props?: ({
|
|
22
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
23
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, HTMLAttributes } from 'react';
|
|
2
2
|
import { VariantProps } from '../../../libs';
|
|
3
3
|
import { Command } from '../../Command';
|
|
4
|
-
import { getMultiSelectItemClasses, getMultiSelectListClasses, getMultiSelectTriggerClasses } from './constants';
|
|
4
|
+
import { getMultiSelectInputClasses, getMultiSelectItemClasses, getMultiSelectListClasses, getMultiSelectTriggerClasses } from './constants';
|
|
5
5
|
export type Item = {
|
|
6
6
|
value: string;
|
|
7
7
|
label?: string;
|
|
@@ -21,11 +21,11 @@ export type MultiSelectContextProps = {
|
|
|
21
21
|
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
22
22
|
activeIndex: number;
|
|
23
23
|
setActiveIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
24
|
-
ref: React.RefObject<HTMLInputElement>;
|
|
24
|
+
ref: React.RefObject<HTMLInputElement | null>;
|
|
25
25
|
handleSelect: (e: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
26
26
|
};
|
|
27
27
|
export type MultiSelectTriggerProps = HTMLAttributes<HTMLDivElement> & VariantProps<typeof getMultiSelectTriggerClasses>;
|
|
28
|
-
export type MultiSelectInputProps = ComponentPropsWithoutRef<typeof Command.Input>;
|
|
28
|
+
export type MultiSelectInputProps = Omit<ComponentPropsWithoutRef<typeof Command.Input>, "size"> & VariantProps<typeof getMultiSelectInputClasses>;
|
|
29
29
|
export type MultiSelectContentProps = HTMLAttributes<HTMLDivElement>;
|
|
30
30
|
export type MultiSelectListProps = ComponentPropsWithoutRef<typeof Command.List> & VariantProps<typeof getMultiSelectListClasses>;
|
|
31
31
|
export type MultiSelectItemProps = Item & ComponentPropsWithoutRef<typeof Command.Item> & VariantProps<typeof getMultiSelectItemClasses>;
|
|
@@ -8,6 +8,9 @@ export declare const getSelectItemClasses: (props?: ({
|
|
|
8
8
|
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
9
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
10
|
export declare const getSelectLabelClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
11
|
+
export declare const getSelectValueClasses: (props?: ({
|
|
12
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
11
14
|
export declare const getSelectSeparatorClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
12
15
|
export declare const getSelectContentClasses: (props?: ({
|
|
13
16
|
position?: "popper" | "item-aligned" | null | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from '../../../libs';
|
|
2
|
-
import { getSelectContentClasses, getSelectTriggerClasses } from './constants';
|
|
2
|
+
import { getSelectContentClasses, getSelectTriggerClasses, getSelectValueClasses } from './constants';
|
|
3
3
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
4
4
|
export type SelectTriggerProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> & VariantProps<typeof getSelectTriggerClasses>;
|
|
5
5
|
export type SelectItemProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item> & VariantProps<typeof getSelectTriggerClasses>;
|
|
6
6
|
export type SelectContentProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> & VariantProps<typeof getSelectContentClasses>;
|
|
7
|
+
export type SelectValueProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value> & VariantProps<typeof getSelectValueClasses>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from '../../../../libs';
|
|
2
2
|
import { getFormControlClasses } from './constants';
|
|
3
3
|
export type As = "div" | "span" | "label";
|
|
4
|
-
type AllowedElements = Pick<JSX.IntrinsicElements, As>;
|
|
4
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
5
5
|
export type FormControlProps<T extends As> = (T extends "label" ? React.LabelHTMLAttributes<HTMLLabelElement> : React.HTMLAttributes<HTMLElement & AllowedElements[T]>) & VariantProps<typeof getFormControlClasses> & {
|
|
6
6
|
as?: T;
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from '../../libs';
|
|
2
2
|
import { getTextClasses } from './constants';
|
|
3
3
|
export type As = "h1" | "h2" | "h3" | "h4" | "h5" | "p" | "span";
|
|
4
|
-
type AllowedElements = Pick<JSX.IntrinsicElements, As>;
|
|
4
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
5
5
|
export type TextProps<T extends As> = React.HTMLAttributes<HTMLElement & AllowedElements[T]> & VariantProps<typeof getTextClasses> & {
|
|
6
6
|
as?: As;
|
|
7
7
|
};
|
|
@@ -6,8 +6,8 @@ declare const Timeline: {
|
|
|
6
6
|
icon?: React.ReactNode;
|
|
7
7
|
} & Omit<{
|
|
8
8
|
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "content" | undefined;
|
|
9
|
-
status?: "default" | "success" | "active" | "failed" | "custom" | undefined;
|
|
10
9
|
fill?: boolean | undefined;
|
|
10
|
+
status?: "default" | "success" | "active" | "failed" | "custom" | undefined;
|
|
11
11
|
border?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "content" | undefined;
|
|
12
12
|
}, "status"> & {
|
|
13
13
|
status?: Exclude<"default" | "success" | "active" | "failed" | "custom" | undefined, "custom">;
|
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.1.0",
|
|
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
|
|
56
|
+
"lint": "eslint --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",
|
|
@@ -68,109 +68,113 @@
|
|
|
68
68
|
"test:watch": "vitest"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@dnd-kit/core": "^6.1
|
|
72
|
-
"@dnd-kit/modifiers": "^
|
|
73
|
-
"@dnd-kit/sortable": "^
|
|
71
|
+
"@dnd-kit/core": "^6.3.1",
|
|
72
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
73
|
+
"@dnd-kit/sortable": "^10.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.
|
|
84
|
-
"@radix-ui/react-label": "^2.1.
|
|
85
|
-
"@radix-ui/react-menubar": "^1.1.
|
|
86
|
-
"@radix-ui/react-navigation-menu": "^1.2.
|
|
87
|
-
"@radix-ui/react-popover": "^1.1.
|
|
88
|
-
"@radix-ui/react-progress": "^1.1.
|
|
89
|
-
"@radix-ui/react-scroll-area": "^1.2.
|
|
90
|
-
"@radix-ui/react-select": "^2.1.
|
|
91
|
-
"@radix-ui/react-separator": "^1.1.
|
|
92
|
-
"@radix-ui/react-slider": "^1.2.
|
|
93
|
-
"@radix-ui/react-slot": "^1.1.
|
|
94
|
-
"@radix-ui/react-tabs": "^1.1.
|
|
95
|
-
"@radix-ui/react-toggle": "^1.1.
|
|
96
|
-
"@radix-ui/react-toggle-group": "^1.1.
|
|
97
|
-
"@radix-ui/react-tooltip": "^1.1.
|
|
75
|
+
"@radix-ui/react-accordion": "^1.2.2",
|
|
76
|
+
"@radix-ui/react-alert-dialog": "^1.1.4",
|
|
77
|
+
"@radix-ui/react-avatar": "^1.1.2",
|
|
78
|
+
"@radix-ui/react-checkbox": "^1.1.3",
|
|
79
|
+
"@radix-ui/react-collapsible": "^1.1.2",
|
|
80
|
+
"@radix-ui/react-context-menu": "^2.2.4",
|
|
81
|
+
"@radix-ui/react-dialog": "^1.1.4",
|
|
82
|
+
"@radix-ui/react-dropdown-menu": "^2.1.4",
|
|
83
|
+
"@radix-ui/react-hover-card": "^1.1.4",
|
|
84
|
+
"@radix-ui/react-label": "^2.1.1",
|
|
85
|
+
"@radix-ui/react-menubar": "^1.1.4",
|
|
86
|
+
"@radix-ui/react-navigation-menu": "^1.2.3",
|
|
87
|
+
"@radix-ui/react-popover": "^1.1.4",
|
|
88
|
+
"@radix-ui/react-progress": "^1.1.1",
|
|
89
|
+
"@radix-ui/react-scroll-area": "^1.2.2",
|
|
90
|
+
"@radix-ui/react-select": "^2.1.4",
|
|
91
|
+
"@radix-ui/react-separator": "^1.1.1",
|
|
92
|
+
"@radix-ui/react-slider": "^1.2.2",
|
|
93
|
+
"@radix-ui/react-slot": "^1.1.1",
|
|
94
|
+
"@radix-ui/react-tabs": "^1.1.2",
|
|
95
|
+
"@radix-ui/react-toggle": "^1.1.1",
|
|
96
|
+
"@radix-ui/react-toggle-group": "^1.1.1",
|
|
97
|
+
"@radix-ui/react-tooltip": "^1.1.6",
|
|
98
98
|
"@tailwindcss/typography": "^0.5.15",
|
|
99
99
|
"chrono-node": "^2.7.7",
|
|
100
|
-
"class-variance-authority": "^0.7.
|
|
100
|
+
"class-variance-authority": "^0.7.1",
|
|
101
101
|
"clsx": "^2.1.1",
|
|
102
|
-
"cmdk": "^1.0.
|
|
103
|
-
"daisyui": "^4.12.
|
|
102
|
+
"cmdk": "^1.0.4",
|
|
103
|
+
"daisyui": "^4.12.23",
|
|
104
104
|
"date-fns": "^4.1.0",
|
|
105
|
-
"embla-carousel-react": "^8.
|
|
106
|
-
"lucide-react": "^0.
|
|
107
|
-
"react-day-picker": "^9.
|
|
108
|
-
"react-dropzone": "^14.
|
|
109
|
-
"react-international-phone": "^4.
|
|
105
|
+
"embla-carousel-react": "^8.5.1",
|
|
106
|
+
"lucide-react": "^0.469.0",
|
|
107
|
+
"react-day-picker": "^9.4.4",
|
|
108
|
+
"react-dropzone": "^14.3.5",
|
|
109
|
+
"react-international-phone": "^4.4.0",
|
|
110
110
|
"react-otp-input": "^3.1.1",
|
|
111
|
-
"sonner": "^1.
|
|
112
|
-
"tailwind-merge": "^2.
|
|
111
|
+
"sonner": "^1.7.1",
|
|
112
|
+
"tailwind-merge": "^2.6.0",
|
|
113
113
|
"tailwindcss-animate": "^1.0.7",
|
|
114
|
-
"timescape": "^0.6.
|
|
115
|
-
"universal-cookie": "^7.2.
|
|
116
|
-
"vaul": "^1.1.
|
|
114
|
+
"timescape": "^0.6.2",
|
|
115
|
+
"universal-cookie": "^7.2.2",
|
|
116
|
+
"vaul": "^1.1.2"
|
|
117
117
|
},
|
|
118
118
|
"devDependencies": {
|
|
119
|
-
"@
|
|
120
|
-
"@
|
|
121
|
-
"@storybook/addon-
|
|
122
|
-
"@storybook/addon-
|
|
123
|
-
"@storybook/addon-
|
|
124
|
-
"@storybook/addon-
|
|
125
|
-
"@storybook/addon-
|
|
126
|
-
"@storybook/addon-
|
|
127
|
-
"@storybook/addon-
|
|
128
|
-
"@storybook/addon-
|
|
129
|
-
"@storybook/
|
|
130
|
-
"@storybook/
|
|
131
|
-
"@storybook/react
|
|
132
|
-
"@storybook/
|
|
133
|
-
"@storybook/test
|
|
134
|
-
"@
|
|
135
|
-
"@testing-library/
|
|
119
|
+
"@eslint/js": "^9.17.0",
|
|
120
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.4.0",
|
|
121
|
+
"@storybook/addon-a11y": "^8.4.7",
|
|
122
|
+
"@storybook/addon-coverage": "^1.0.5",
|
|
123
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
124
|
+
"@storybook/addon-interactions": "^8.4.7",
|
|
125
|
+
"@storybook/addon-links": "^8.4.7",
|
|
126
|
+
"@storybook/addon-onboarding": "^8.4.7",
|
|
127
|
+
"@storybook/addon-storysource": "^8.4.7",
|
|
128
|
+
"@storybook/addon-themes": "^8.4.7",
|
|
129
|
+
"@storybook/addon-viewport": "^8.4.7",
|
|
130
|
+
"@storybook/blocks": "^8.4.7",
|
|
131
|
+
"@storybook/react": "^8.4.7",
|
|
132
|
+
"@storybook/react-vite": "^8.4.7",
|
|
133
|
+
"@storybook/test": "^8.4.7",
|
|
134
|
+
"@storybook/test-runner": "^0.21.0",
|
|
135
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
136
|
+
"@testing-library/react": "^16.1.0",
|
|
136
137
|
"@testing-library/user-event": "^14.5.2",
|
|
138
|
+
"@types/eslint__js": "^8.42.3",
|
|
137
139
|
"@types/jest-image-snapshot": "^6.4.0",
|
|
138
|
-
"@types/node": "^22.
|
|
139
|
-
"@types/react": "^
|
|
140
|
-
"@types/react-dom": "^
|
|
141
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
142
|
-
"@typescript-eslint/parser": "^8.
|
|
143
|
-
"@vitejs/plugin-react": "^4.3.
|
|
144
|
-
"@vitest/coverage-v8": "^2.1.
|
|
145
|
-
"@vitest/ui": "^2.1.
|
|
140
|
+
"@types/node": "^22.10.2",
|
|
141
|
+
"@types/react": "^19.0.2",
|
|
142
|
+
"@types/react-dom": "^19.0.2",
|
|
143
|
+
"@typescript-eslint/eslint-plugin": "^8.18.2",
|
|
144
|
+
"@typescript-eslint/parser": "^8.18.2",
|
|
145
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
146
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
147
|
+
"@vitest/ui": "^2.1.8",
|
|
146
148
|
"autoprefixer": "^10.4.20",
|
|
147
149
|
"axe-playwright": "^2.0.3",
|
|
148
|
-
"eslint": "^
|
|
149
|
-
"eslint-plugin-react": "^7.37.
|
|
150
|
-
"eslint-plugin-react-hooks": "^
|
|
151
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
152
|
-
"eslint-plugin-storybook": "^0.
|
|
150
|
+
"eslint": "^9.17.0",
|
|
151
|
+
"eslint-plugin-react": "^7.37.3",
|
|
152
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
153
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
154
|
+
"eslint-plugin-storybook": "^0.11.1",
|
|
155
|
+
"globals": "^15.14.0",
|
|
153
156
|
"jest-image-snapshot": "^6.4.0",
|
|
154
157
|
"jsdom": "^25.0.1",
|
|
155
158
|
"path": "^0.12.7",
|
|
156
|
-
"postcss": "^8.4.
|
|
157
|
-
"prettier": "^3.
|
|
158
|
-
"react": "^
|
|
159
|
-
"react-dom": "^
|
|
160
|
-
"react-router-dom": "^
|
|
161
|
-
"recharts": "^2.
|
|
162
|
-
"storybook": "^8.
|
|
163
|
-
"tailwindcss": "^3.4.
|
|
164
|
-
"typescript": "^5.
|
|
165
|
-
"
|
|
166
|
-
"vite
|
|
167
|
-
"
|
|
159
|
+
"postcss": "^8.4.49",
|
|
160
|
+
"prettier": "^3.4.2",
|
|
161
|
+
"react": "^19.0.0",
|
|
162
|
+
"react-dom": "^19.0.0",
|
|
163
|
+
"react-router-dom": "^7.1.1",
|
|
164
|
+
"recharts": "^2.15.0",
|
|
165
|
+
"storybook": "^8.4.7",
|
|
166
|
+
"tailwindcss": "^3.4.17",
|
|
167
|
+
"typescript": "^5.7.2",
|
|
168
|
+
"typescript-eslint": "^8.18.2",
|
|
169
|
+
"vite": "^6.0.6",
|
|
170
|
+
"vite-plugin-dts": "^4.4.0",
|
|
171
|
+
"vitest": "^2.1.8"
|
|
168
172
|
},
|
|
169
173
|
"peerDependencies": {
|
|
170
|
-
"react": "^
|
|
171
|
-
"react-dom": "^
|
|
172
|
-
"recharts": "^2.
|
|
173
|
-
"typescript": "^5.
|
|
174
|
+
"react": "^19.0.0",
|
|
175
|
+
"react-dom": "^19.0.0",
|
|
176
|
+
"recharts": "^2.15.0",
|
|
177
|
+
"typescript": "^5.7.2"
|
|
174
178
|
},
|
|
175
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "ff5cee34c88f8622c5c748163a8f7c3f9aeda72d"
|
|
176
180
|
}
|
|
@@ -11,7 +11,7 @@ import { type ChartProps } from "./types";
|
|
|
11
11
|
export const Chart = forwardRef<HTMLDivElement, ChartProps>(
|
|
12
12
|
({ id, className, children, config, ...props }, ref) => {
|
|
13
13
|
const uniqueId = useId();
|
|
14
|
-
const chartId = `chart-${id
|
|
14
|
+
const chartId = `chart-${id ?? uniqueId.replace(/:/g, "")}`;
|
|
15
15
|
|
|
16
16
|
return (
|
|
17
17
|
<ChartContext.Provider value={{ config }}>
|
|
@@ -26,12 +26,10 @@ export const ChartLegendContent = forwardRef<HTMLDivElement, ChartLegendContentP
|
|
|
26
26
|
return (
|
|
27
27
|
<div ref={ref} className={cn(getChartLegendContainerClasses({ verticalAlign }), className)}>
|
|
28
28
|
{payload.map((item) => {
|
|
29
|
-
|
|
30
|
-
const key = `${nameKey || item.dataKey || "value"}`;
|
|
29
|
+
const key = `${nameKey ?? item.dataKey ?? "value"}`;
|
|
31
30
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
32
31
|
|
|
33
32
|
return (
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
35
33
|
<div key={item.value} className={getChartLegendItemClasses()}>
|
|
36
34
|
{itemConfig?.icon && !hideIcon ? (
|
|
37
35
|
<itemConfig.icon />
|
|
@@ -3,7 +3,7 @@ import { THEMES } from "../constants";
|
|
|
3
3
|
import { type ChartStyleProps } from "../types";
|
|
4
4
|
|
|
5
5
|
export const ChartStyle = ({ id, config }: ChartStyleProps) => {
|
|
6
|
-
const colorConfig = Object.entries(config).filter(([, config]) => config.theme
|
|
6
|
+
const colorConfig = Object.entries(config).filter(([, config]) => config.theme ?? config.color);
|
|
7
7
|
|
|
8
8
|
if (!colorConfig.length) {
|
|
9
9
|
return null;
|
|
@@ -18,7 +18,7 @@ export const ChartStyle = ({ id, config }: ChartStyleProps) => {
|
|
|
18
18
|
${prefix} [data-chart=${id}] {
|
|
19
19
|
${colorConfig
|
|
20
20
|
.map(([key, itemConfig]) => {
|
|
21
|
-
const color = itemConfig.theme?.[theme as Theme]
|
|
21
|
+
const color = itemConfig.theme?.[theme as Theme] ?? itemConfig.color;
|
|
22
22
|
return color ? ` --color-${key}: ${color};` : null;
|
|
23
23
|
})
|
|
24
24
|
.join("\n")}
|
|
@@ -44,10 +44,12 @@ export const ChartTooltipContent = forwardRef<HTMLDivElement, ChartTooltipConten
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const [item] = payload;
|
|
47
|
-
const key = `${labelKey
|
|
47
|
+
const key = `${labelKey ?? item.dataKey ?? item.name ?? "value"}`;
|
|
48
48
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
49
49
|
const value =
|
|
50
|
-
!labelKey && typeof label === "string"
|
|
50
|
+
!labelKey && typeof label === "string"
|
|
51
|
+
? (config[label]?.label ?? label)
|
|
52
|
+
: itemConfig?.label;
|
|
51
53
|
|
|
52
54
|
if (labelFormatter) {
|
|
53
55
|
return (
|
|
@@ -73,12 +75,12 @@ export const ChartTooltipContent = forwardRef<HTMLDivElement, ChartTooltipConten
|
|
|
73
75
|
{!nestLabel ? tooltipLabel : null}
|
|
74
76
|
<div className="grid gap-1.5">
|
|
75
77
|
{payload.map((item, index) => {
|
|
76
|
-
const key = `${nameKey
|
|
78
|
+
const key = `${nameKey ?? item.name ?? item.dataKey ?? "value"}`;
|
|
77
79
|
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
78
80
|
const indicatorColor =
|
|
79
|
-
color
|
|
80
|
-
(item.payload as { fill: string }).fill
|
|
81
|
-
item.color
|
|
81
|
+
color ??
|
|
82
|
+
(item.payload as { fill: string }).fill ??
|
|
83
|
+
item.color ??
|
|
82
84
|
(item as { fill: string }).fill;
|
|
83
85
|
|
|
84
86
|
return (
|
|
@@ -105,7 +107,7 @@ export const ChartTooltipContent = forwardRef<HTMLDivElement, ChartTooltipConten
|
|
|
105
107
|
<div className={getChartTooltipItemLabelClasses({ nestLabel })}>
|
|
106
108
|
<div className="grid gap-1.5">
|
|
107
109
|
{nestLabel ? tooltipLabel : null}
|
|
108
|
-
<span>{itemConfig?.label
|
|
110
|
+
<span>{itemConfig?.label ?? item.name}</span>
|
|
109
111
|
</div>
|
|
110
112
|
{item.value && (
|
|
111
113
|
<span className={getChartTooltipItemValueClasses()}>
|
|
@@ -126,7 +126,7 @@ export const TextRadialChartExample = (props: Partial<RadialBarChartProps>) => {
|
|
|
126
126
|
>
|
|
127
127
|
{chartData[0].visitors.toLocaleString()}
|
|
128
128
|
</tspan>
|
|
129
|
-
<tspan x={viewBox.cx} y={(viewBox.cy
|
|
129
|
+
<tspan x={viewBox.cx} y={(viewBox.cy ?? 0) + 24} className="fill-base-content">
|
|
130
130
|
Visitors
|
|
131
131
|
</tspan>
|
|
132
132
|
</text>
|
|
@@ -176,7 +176,7 @@ export const ShapeRadialChartExample = (props: Partial<RadialBarChartProps>) =>
|
|
|
176
176
|
>
|
|
177
177
|
{chartData[0].visitors.toLocaleString()}
|
|
178
178
|
</tspan>
|
|
179
|
-
<tspan x={viewBox.cx} y={(viewBox.cy
|
|
179
|
+
<tspan x={viewBox.cx} y={(viewBox.cy ?? 0) + 24} className="fill-base-content">
|
|
180
180
|
Visitors
|
|
181
181
|
</tspan>
|
|
182
182
|
</text>
|
|
@@ -217,12 +217,12 @@ export const StackedRadialChartExample = (props: Partial<RadialBarChartProps>) =
|
|
|
217
217
|
<text x={viewBox.cx} y={viewBox.cy} textAnchor="middle">
|
|
218
218
|
<tspan
|
|
219
219
|
x={viewBox.cx}
|
|
220
|
-
y={(viewBox.cy
|
|
220
|
+
y={(viewBox.cy ?? 0) - 16}
|
|
221
221
|
className="fill-foreground text-2xl font-bold"
|
|
222
222
|
>
|
|
223
223
|
{totalVisitors.toLocaleString()}
|
|
224
224
|
</tspan>
|
|
225
|
-
<tspan x={viewBox.cx} y={(viewBox.cy
|
|
225
|
+
<tspan x={viewBox.cx} y={(viewBox.cy ?? 0) + 4} className="fill-base-content">
|
|
226
226
|
Visitors
|
|
227
227
|
</tspan>
|
|
228
228
|
</text>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArgTypes, StoryContext
|
|
1
|
+
import type { ArgTypes, StoryContext } from "@storybook/react";
|
|
2
2
|
import type { ComponentProps, ElementType } from "react";
|
|
3
3
|
|
|
4
4
|
export const categorizeArgs = (args: ArgTypes, category: string) => {
|
|
@@ -27,7 +27,7 @@ const getCategorizedArgs = <T,>(args: ArgTypes<T>) => {
|
|
|
27
27
|
}, {} as ArgTypes);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const withArgs = <T extends object>(Component:
|
|
30
|
+
export const withArgs = <T extends object>(Component: React.FC, context: StoryContext<T>) => {
|
|
31
31
|
context.args = getCategorizedArgs(context.args) as T;
|
|
32
32
|
|
|
33
33
|
return <Component />;
|
|
@@ -70,6 +70,6 @@ export const getArgsFromArgTypes = <T extends ArgTypes>(argsTypes: T) => {
|
|
|
70
70
|
export const renderer = <T extends ElementType>(Component: T) => {
|
|
71
71
|
const component = <G,>(props: G) => <Component {...(props as ComponentProps<T>)} />;
|
|
72
72
|
component.displayName =
|
|
73
|
-
(Component as React.FC<unknown>).displayName
|
|
73
|
+
(Component as React.FC<unknown>).displayName ?? (Component as React.FC<unknown>).name;
|
|
74
74
|
return component;
|
|
75
75
|
};
|
|
@@ -15,7 +15,7 @@ export type DatePickerProps = BaseDatePickerProps &
|
|
|
15
15
|
}: {
|
|
16
16
|
date: Date | undefined;
|
|
17
17
|
setDate: React.Dispatch<React.SetStateAction<Date | undefined>>;
|
|
18
|
-
}) => JSX.Element | null;
|
|
18
|
+
}) => React.JSX.Element | null;
|
|
19
19
|
defaultDate?: Date;
|
|
20
20
|
getDateLabel?: (date: Date | undefined) => string | undefined;
|
|
21
21
|
getDateValue?: (date: Date | undefined) => string | undefined;
|
|
@@ -28,12 +28,12 @@ export type DateRangePickerProps = BaseDatePickerProps &
|
|
|
28
28
|
from: string | undefined;
|
|
29
29
|
to: string | undefined;
|
|
30
30
|
};
|
|
31
|
-
getRangeLabel?: (range: DateRange | undefined) => string | JSX.Element | undefined;
|
|
31
|
+
getRangeLabel?: (range: DateRange | undefined) => string | React.JSX.Element | undefined;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export type MultipleDatesPickerProps = BaseDatePickerProps &
|
|
35
35
|
Omit<PropsMulti, "mode"> & {
|
|
36
36
|
defaultDates?: Date[];
|
|
37
37
|
getDatesValue?: (dates: Date[] | undefined) => string[] | undefined;
|
|
38
|
-
getDatesLabel?: (dates: Date[] | undefined) => string | JSX.Element | undefined;
|
|
38
|
+
getDatesLabel?: (dates: Date[] | undefined) => string | React.JSX.Element | undefined;
|
|
39
39
|
};
|
|
@@ -29,7 +29,7 @@ export const Droppable = ({
|
|
|
29
29
|
className={cn(className, getDroppableClasses({ isDragging, isOver, isEmpty }))}
|
|
30
30
|
data-empty={isEmpty}
|
|
31
31
|
data-draggable-over={isOver || undefined}
|
|
32
|
-
data-draggable-active={isDragging
|
|
32
|
+
data-draggable-active={isDragging ?? undefined}
|
|
33
33
|
{...props}
|
|
34
34
|
>
|
|
35
35
|
{children}
|
|
@@ -18,6 +18,7 @@ import { Badge } from "../../Badge";
|
|
|
18
18
|
import { Command } from "../../Command";
|
|
19
19
|
import {
|
|
20
20
|
getMultiSelectClasses,
|
|
21
|
+
getMultiSelectInputClasses,
|
|
21
22
|
getMultiSelectItemClasses,
|
|
22
23
|
getMultiSelectListClasses,
|
|
23
24
|
getMultiSelectTagClasses,
|
|
@@ -247,7 +248,7 @@ export const MultiSelectTrigger = ({
|
|
|
247
248
|
|
|
248
249
|
MultiSelectTrigger.displayName = "MultiSelectTrigger";
|
|
249
250
|
|
|
250
|
-
const MultiSelectInput = ({ className, ...props }: MultiSelectInputProps) => {
|
|
251
|
+
const MultiSelectInput = ({ className, size, ...props }: MultiSelectInputProps) => {
|
|
251
252
|
const {
|
|
252
253
|
setOpen,
|
|
253
254
|
inputValue,
|
|
@@ -270,9 +271,9 @@ const MultiSelectInput = ({ className, ...props }: MultiSelectInputProps) => {
|
|
|
270
271
|
onFocus={() => setOpen(true)}
|
|
271
272
|
onClick={() => setActiveIndex(-1)}
|
|
272
273
|
className={cn(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
getMultiSelectInputClasses({ size }),
|
|
275
|
+
{ "caret-transparent": activeIndex !== -1 },
|
|
276
|
+
className
|
|
276
277
|
)}
|
|
277
278
|
/>
|
|
278
279
|
);
|
|
@@ -309,7 +310,7 @@ const MultiSelectList = forwardRef<ComponentRef<typeof Command.List>, MultiSelec
|
|
|
309
310
|
MultiSelectList.displayName = "MultiSelectList";
|
|
310
311
|
|
|
311
312
|
const MultiSelectItem = forwardRef<ComponentRef<typeof Command.Item>, MultiSelectItemProps>(
|
|
312
|
-
({ className, value, label, children, size, disabled, ...props }, ref) => {
|
|
313
|
+
({ className, value, label, children, size, disabled, variant, ...props }, ref) => {
|
|
313
314
|
const { values: options, onValueChange, setInputValue } = useMultiSelect();
|
|
314
315
|
|
|
315
316
|
const mousePreventDefault = useCallback((e: MouseEvent) => {
|
|
@@ -327,7 +328,7 @@ const MultiSelectItem = forwardRef<ComponentRef<typeof Command.Item>, MultiSelec
|
|
|
327
328
|
onValueChange(value, label);
|
|
328
329
|
setInputValue("");
|
|
329
330
|
}}
|
|
330
|
-
className={cn(getMultiSelectItemClasses({ included, disabled, size }), className)}
|
|
331
|
+
className={cn(getMultiSelectItemClasses({ included, disabled, variant, size }), className)}
|
|
331
332
|
onMouseDown={mousePreventDefault}
|
|
332
333
|
>
|
|
333
334
|
{children}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import { cva } from "../../../libs";
|
|
2
2
|
|
|
3
|
-
export const getMultiSelectClasses = cva(
|
|
4
|
-
"overflow-visible bg-transparent flex flex-col h-fit w-fit"
|
|
5
|
-
);
|
|
3
|
+
export const getMultiSelectClasses = cva("overflow-visible bg-transparent flex flex-col h-fit");
|
|
6
4
|
|
|
7
5
|
export const getMultiSelectTriggerClasses = cva(
|
|
8
|
-
"flex items-center flex-wrap gap-1 h-fit px-1 py-2 rounded-md transition-all overflow-hidden",
|
|
6
|
+
"flex items-center flex-wrap gap-1 h-fit w-fit px-1 py-2 rounded-md transition-all overflow-hidden",
|
|
9
7
|
{
|
|
10
8
|
variants: {
|
|
11
9
|
variant: {
|
|
12
10
|
default: "border-0",
|
|
13
11
|
accent: "border border-accent",
|
|
14
12
|
error: "border border-error",
|
|
15
|
-
ghost: "border border-ghost",
|
|
16
13
|
info: "border border-info",
|
|
17
14
|
primary: "border border-primary",
|
|
18
15
|
secondary: "border border-secondary",
|
|
@@ -55,7 +52,7 @@ export const getMultiSelectTriggerClasses = cva(
|
|
|
55
52
|
);
|
|
56
53
|
|
|
57
54
|
export const getMultiSelectItemClasses = cva(
|
|
58
|
-
"
|
|
55
|
+
"cursor-pointer transition-colors flex justify-between aria-selected:bg-base-300 aria-selected:text-base-content rounded-sm py-1.5 px-2 text-sm outline-none",
|
|
59
56
|
{
|
|
60
57
|
variants: {
|
|
61
58
|
included: {
|
|
@@ -70,12 +67,22 @@ export const getMultiSelectItemClasses = cva(
|
|
|
70
67
|
md: "px-2 text-sm",
|
|
71
68
|
lg: "px-3 text-lg",
|
|
72
69
|
},
|
|
70
|
+
variant: {
|
|
71
|
+
default: "aria-selected:bg-transparent aria-selected:text-base-content",
|
|
72
|
+
primary: "aria-selected:bg-primary aria-selected:text-primary-content",
|
|
73
|
+
secondary: "aria-selected:bg-secondary aria-selected:text-secondary-content",
|
|
74
|
+
accent: "aria-selected:bg-accent aria-selected:text-accent-content",
|
|
75
|
+
success: "aria-selected:bg-success aria-selected:text-success-content",
|
|
76
|
+
warning: "aria-selected:bg-warning aria-selected:text-warning-content",
|
|
77
|
+
info: "aria-selected:bg-info aria-selected:text-info-content",
|
|
78
|
+
error: "aria-selected:bg-error aria-selected:text-error-content",
|
|
79
|
+
},
|
|
73
80
|
},
|
|
74
81
|
}
|
|
75
82
|
);
|
|
76
83
|
|
|
77
84
|
export const getMultiSelectListClasses = cva(
|
|
78
|
-
"p-
|
|
85
|
+
"p-1 bg-base-100 flex flex-col gap-2 rounded-md scrollbar-thin scrollbar-track-transparent transition-colors scrollbar-thumb-muted-foreground dark:scrollbar-thumb-muted scrollbar-thumb-rounded-lg w-full absolute shadow-md z-10 border border-muted top-1",
|
|
79
86
|
{
|
|
80
87
|
variants: {
|
|
81
88
|
size: {
|
|
@@ -101,3 +108,14 @@ export const getMultiSelectTagClasses = cva(
|
|
|
101
108
|
},
|
|
102
109
|
}
|
|
103
110
|
);
|
|
111
|
+
|
|
112
|
+
export const getMultiSelectInputClasses = cva("bg-transparent outline-none flex-1", {
|
|
113
|
+
variants: {
|
|
114
|
+
size: {
|
|
115
|
+
xs: "text-xs",
|
|
116
|
+
sm: "text-sm",
|
|
117
|
+
md: "text-md",
|
|
118
|
+
lg: "text-lg",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
});
|
|
@@ -2,6 +2,7 @@ import { ComponentPropsWithoutRef, HTMLAttributes } from "react";
|
|
|
2
2
|
import { VariantProps } from "../../../libs";
|
|
3
3
|
import { Command } from "../../Command";
|
|
4
4
|
import {
|
|
5
|
+
getMultiSelectInputClasses,
|
|
5
6
|
getMultiSelectItemClasses,
|
|
6
7
|
getMultiSelectListClasses,
|
|
7
8
|
getMultiSelectTriggerClasses,
|
|
@@ -28,14 +29,15 @@ export type MultiSelectContextProps = {
|
|
|
28
29
|
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
29
30
|
activeIndex: number;
|
|
30
31
|
setActiveIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
31
|
-
ref: React.RefObject<HTMLInputElement>;
|
|
32
|
+
ref: React.RefObject<HTMLInputElement | null>;
|
|
32
33
|
handleSelect: (e: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
export type MultiSelectTriggerProps = HTMLAttributes<HTMLDivElement> &
|
|
36
37
|
VariantProps<typeof getMultiSelectTriggerClasses>;
|
|
37
38
|
|
|
38
|
-
export type MultiSelectInputProps = ComponentPropsWithoutRef<typeof Command.Input
|
|
39
|
+
export type MultiSelectInputProps = Omit<ComponentPropsWithoutRef<typeof Command.Input>, "size"> &
|
|
40
|
+
VariantProps<typeof getMultiSelectInputClasses>;
|
|
39
41
|
|
|
40
42
|
export type MultiSelectContentProps = HTMLAttributes<HTMLDivElement>;
|
|
41
43
|
|
|
@@ -28,7 +28,7 @@ const Phone = React.forwardRef<HTMLInputElement, PhoneProps>(
|
|
|
28
28
|
) => {
|
|
29
29
|
const [open, setOpen] = React.useState(false);
|
|
30
30
|
const { inputValue, handlePhoneValueChange, inputRef, country, setCountry } = usePhoneInput({
|
|
31
|
-
value: String(defaultValue)
|
|
31
|
+
value: defaultValue ? String(defaultValue) : "+231",
|
|
32
32
|
defaultCountry: "lr",
|
|
33
33
|
forceDialCode: true,
|
|
34
34
|
inputRef: ref as MutableRefObject<HTMLInputElement | null>,
|
|
@@ -47,7 +47,7 @@ export const getSelectTriggerClasses = cva(
|
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
export const getSelectItemClasses = cva(
|
|
50
|
-
"relative flex w-full cursor-pointer select-none items-center focus:bg-
|
|
50
|
+
"relative flex w-full cursor-pointer select-none items-center focus:bg-base-300 focus:text-base-content rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
51
51
|
{
|
|
52
52
|
variants: {
|
|
53
53
|
variant: {
|
|
@@ -66,6 +66,17 @@ export const getSelectItemClasses = cva(
|
|
|
66
66
|
|
|
67
67
|
export const getSelectLabelClasses = cva("px-2 py-1.5 text-sm font-semibold");
|
|
68
68
|
|
|
69
|
+
export const getSelectValueClasses = cva("", {
|
|
70
|
+
variants: {
|
|
71
|
+
size: {
|
|
72
|
+
xs: "text-xs",
|
|
73
|
+
sm: "text-sm",
|
|
74
|
+
md: "text-md",
|
|
75
|
+
lg: "text-lg",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
69
80
|
export const getSelectSeparatorClasses = cva("-mx-1 my-1 h-px bg-muted");
|
|
70
81
|
|
|
71
82
|
export const getSelectContentClasses = cva(
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
2
2
|
import { type VariantProps } from "../../../libs";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getSelectContentClasses,
|
|
5
|
+
getSelectTriggerClasses,
|
|
6
|
+
getSelectValueClasses,
|
|
7
|
+
} from "./constants";
|
|
4
8
|
|
|
5
9
|
export type SelectTriggerProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger> &
|
|
6
10
|
VariantProps<typeof getSelectTriggerClasses>;
|
|
@@ -10,3 +14,6 @@ export type SelectItemProps = React.ComponentPropsWithoutRef<typeof SelectPrimit
|
|
|
10
14
|
|
|
11
15
|
export type SelectContentProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content> &
|
|
12
16
|
VariantProps<typeof getSelectContentClasses>;
|
|
17
|
+
|
|
18
|
+
export type SelectValueProps = React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value> &
|
|
19
|
+
VariantProps<typeof getSelectValueClasses>;
|
|
@@ -3,7 +3,7 @@ import { getFormControlClasses } from "./constants";
|
|
|
3
3
|
|
|
4
4
|
export type As = "div" | "span" | "label";
|
|
5
5
|
|
|
6
|
-
type AllowedElements = Pick<JSX.IntrinsicElements, As>;
|
|
6
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
7
7
|
|
|
8
8
|
export type FormControlProps<T extends As> = (T extends "label"
|
|
9
9
|
? React.LabelHTMLAttributes<HTMLLabelElement>
|
|
@@ -3,7 +3,7 @@ import { getTextClasses } from "./constants";
|
|
|
3
3
|
|
|
4
4
|
export type As = "h1" | "h2" | "h3" | "h4" | "h5" | "p" | "span";
|
|
5
5
|
|
|
6
|
-
type AllowedElements = Pick<JSX.IntrinsicElements, As>;
|
|
6
|
+
type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
|
|
7
7
|
|
|
8
8
|
export type TextProps<T extends As> = React.HTMLAttributes<HTMLElement & AllowedElements[T]> &
|
|
9
9
|
VariantProps<typeof getTextClasses> & {
|