@mbao01/common 0.0.8 → 0.0.10
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/Button/Button.d.ts +7 -7
- package/dist/types/components/Calendar/Calendar.d.ts +5 -0
- package/dist/types/components/Calendar/index.d.ts +1 -0
- package/dist/types/components/Calendar/types.d.ts +3 -0
- package/dist/types/components/Command/Command.d.ts +1 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/types/components/DatePicker/DateRangePicker.d.ts +2 -0
- package/dist/types/components/DatePicker/MultipleDatesPicker.d.ts +2 -0
- package/dist/types/components/DatePicker/index.d.ts +3 -0
- package/dist/types/components/DatePicker/types.d.ts +25 -0
- package/dist/types/components/Dialog/Dialog.d.ts +4 -4
- package/dist/types/components/Form/Checkbox/Checkbox.d.ts +4 -4
- package/dist/types/components/Form/Input/Input.d.ts +6 -6
- package/dist/types/components/Form/Phone/Phone.d.ts +2 -15
- package/dist/types/components/Form/Phone/types.d.ts +1 -7
- package/dist/types/components/Form/Radio/Radio.d.ts +4 -4
- package/dist/types/components/Form/Range/Range.d.ts +6 -6
- package/dist/types/components/Form/Select/Select.d.ts +15 -15
- package/dist/types/components/Form/Slider/Slider.d.ts +12 -12
- package/dist/types/components/Form/Switch/Switch.d.ts +4 -4
- package/dist/types/components/Form/TextField/TextField.d.ts +6 -6
- package/dist/types/components/Form/Textarea/Textarea.d.ts +6 -6
- package/dist/types/components/Popover/Popover.d.ts +1 -1
- package/dist/types/components/Progress/Progress.d.ts +3 -3
- package/dist/types/components/Tooltip/Tooltip.d.ts +3 -3
- package/dist/types/libs/cva.d.ts +6 -1
- package/package.json +4 -2
- package/src/components/Calendar/Calendar.tsx +65 -0
- package/src/components/Calendar/index.ts +1 -0
- package/src/components/Calendar/types.ts +3 -0
- package/src/components/DatePicker/DatePicker.tsx +59 -0
- package/src/components/DatePicker/DateRangePicker.tsx +91 -0
- package/src/components/DatePicker/MultipleDatesPicker.tsx +80 -0
- package/src/components/DatePicker/index.ts +3 -0
- package/src/components/DatePicker/types.ts +42 -0
- package/src/components/Form/Phone/Phone.tsx +20 -14
- package/src/components/Form/Phone/constants.ts +1 -1
- package/src/components/Form/Phone/types.ts +1 -10
- package/src/components/Form/Select/constants.ts +1 -1
- package/src/components/Popover/constants.ts +1 -1
- package/src/libs/cva.ts +10 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> &
|
|
3
|
-
variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
outline?: boolean |
|
|
5
|
-
wide?: boolean |
|
|
6
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
7
|
-
isLoading?: boolean |
|
|
8
|
-
} &
|
|
2
|
+
declare const Button: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
|
+
variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
outline?: boolean | undefined;
|
|
5
|
+
wide?: boolean | undefined;
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
7
|
+
isLoading?: boolean | undefined;
|
|
8
|
+
} & {
|
|
9
9
|
as?: "a" | "span" | "p" | undefined;
|
|
10
10
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
11
11
|
export { Button };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Calendar } from "./Calendar";
|
|
@@ -11,7 +11,7 @@ declare const Command: {
|
|
|
11
11
|
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "onChange" | "type" | "value"> & {
|
|
12
12
|
value?: string | undefined;
|
|
13
13
|
onValueChange?: ((search: string) => void) | undefined;
|
|
14
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> &
|
|
14
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> & {} & React.RefAttributes<HTMLInputElement>>;
|
|
15
15
|
List: React.ForwardRefExoticComponent<Omit<{
|
|
16
16
|
children?: React.ReactNode;
|
|
17
17
|
} & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type MultipleDatesPickerProps } from "./types";
|
|
2
|
+
export declare const MultipleDatesPicker: ({ name, size, wide, label, outline, variant, disabled, defaultDates, getDatesValue, getDatesLabel, ...props }: MultipleDatesPickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DateRange, DayPickerMultipleProps, DayPickerRangeProps, DayPickerSingleProps } from "react-day-picker";
|
|
3
|
+
import { ButtonProps } from "../Button/types";
|
|
4
|
+
type BaseDatePickerProps = Pick<ButtonProps, "variant" | "outline" | "wide" | "size" | "name" | "disabled"> & {
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
export type DatePickerProps = BaseDatePickerProps & Omit<DayPickerSingleProps, "mode" | "selected" | "onSelect"> & {
|
|
8
|
+
defaultDate?: Date;
|
|
9
|
+
getDateLabel?: (date: Date | undefined) => string | undefined;
|
|
10
|
+
getDateValue?: (date: Date | undefined) => string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type DateRangePickerProps = BaseDatePickerProps & Omit<DayPickerRangeProps, "mode" | "selected" | "onSelect"> & {
|
|
13
|
+
defaultRange?: DateRange;
|
|
14
|
+
getRangeValue?: (range: DateRange | undefined) => {
|
|
15
|
+
from: string | undefined;
|
|
16
|
+
to: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
getRangeLabel?: (range: DateRange | undefined) => string | JSX.Element | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type MultipleDatesPickerProps = BaseDatePickerProps & Omit<DayPickerMultipleProps, "mode" | "selected" | "onSelect"> & {
|
|
21
|
+
defaultDates?: Date[];
|
|
22
|
+
getDatesValue?: (dates: Date[] | undefined) => string[] | undefined;
|
|
23
|
+
getDatesLabel?: (dates: Date[] | undefined) => string | JSX.Element | undefined;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -10,13 +10,13 @@ declare const Dialog: {
|
|
|
10
10
|
({ className, ...props }: DialogHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
displayName: string;
|
|
12
12
|
};
|
|
13
|
-
Title: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> &
|
|
14
|
-
Description: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> &
|
|
15
|
-
Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
13
|
+
Title: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & {} & React.RefAttributes<HTMLHeadingElement>>;
|
|
14
|
+
Description: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & {} & React.RefAttributes<HTMLParagraphElement>>;
|
|
15
|
+
Content: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
Footer: {
|
|
17
17
|
({ className, ...props }: DialogFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
displayName: string;
|
|
19
19
|
};
|
|
20
|
-
Overlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
20
|
+
Overlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
};
|
|
22
22
|
export { Dialog };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Checkbox: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> &
|
|
3
|
-
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
5
|
-
} &
|
|
2
|
+
declare const Checkbox: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> & {
|
|
3
|
+
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
5
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { Checkbox };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const Input: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref"> &
|
|
3
|
-
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
outline?: boolean |
|
|
5
|
-
wide?: boolean |
|
|
6
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
7
|
-
} &
|
|
2
|
+
export declare const Input: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref"> & {
|
|
3
|
+
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
outline?: boolean | undefined;
|
|
5
|
+
wide?: boolean | undefined;
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
7
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
5
|
-
outline?: 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> | undefined;
|
|
9
|
-
buttonProps?: import("class-variance-authority").VariantProps<(props?: ({
|
|
10
|
-
variant?: "accent" | "default" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | null | undefined;
|
|
11
|
-
outline?: boolean | null | undefined;
|
|
12
|
-
wide?: boolean | null | undefined;
|
|
13
|
-
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
14
|
-
isLoading?: boolean | null | undefined;
|
|
15
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string> | undefined;
|
|
16
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
2
|
+
import { type PhoneProps } from "./types";
|
|
3
|
+
declare const Phone: React.ForwardRefExoticComponent<PhoneProps & React.RefAttributes<HTMLInputElement>>;
|
|
17
4
|
export { Phone };
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { type VariantProps } from "../../../libs";
|
|
2
1
|
import { type InputProps } from "../Input/types";
|
|
3
|
-
|
|
4
|
-
import { getButtonClasses } from "../../Button/constants";
|
|
5
|
-
export type PhoneProps = Omit<InputProps, "type" | "size" | "label" | "inputMode"> & {
|
|
6
|
-
inputProps?: VariantProps<typeof getInputClasses>;
|
|
7
|
-
buttonProps?: VariantProps<typeof getButtonClasses>;
|
|
8
|
-
};
|
|
2
|
+
export type PhoneProps = Omit<InputProps, "type" | "label" | "inputMode">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Radio: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> &
|
|
3
|
-
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
5
|
-
} &
|
|
2
|
+
declare const Radio: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> & {
|
|
3
|
+
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
5
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { Radio };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Range: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> &
|
|
3
|
-
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} &
|
|
2
|
+
declare const Range: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> & {
|
|
3
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
wide?: boolean | undefined;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
8
8
|
export { Range };
|
|
@@ -4,22 +4,22 @@ declare const Select: {
|
|
|
4
4
|
(props: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
Group: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
6
|
Value: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
7
|
-
Trigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> &
|
|
8
|
-
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
9
|
-
outline?: boolean |
|
|
10
|
-
wide?: boolean |
|
|
11
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
12
|
-
} &
|
|
13
|
-
Content: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
14
|
-
position?: "popper" | "item-aligned" |
|
|
15
|
-
} &
|
|
7
|
+
Trigger: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
8
|
+
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
9
|
+
outline?: boolean | undefined;
|
|
10
|
+
wide?: boolean | undefined;
|
|
11
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
12
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
Content: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
14
|
+
position?: "popper" | "item-aligned" | undefined;
|
|
15
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
16
16
|
Label: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
Item: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
18
|
-
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
19
|
-
outline?: boolean |
|
|
20
|
-
wide?: boolean |
|
|
21
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
22
|
-
} &
|
|
17
|
+
Item: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
18
|
+
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
19
|
+
outline?: boolean | undefined;
|
|
20
|
+
wide?: boolean | undefined;
|
|
21
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
22
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
23
23
|
Separator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
24
|
ScrollUpButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
25
|
ScrollDownButton: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as SliderPrimitive from "@radix-ui/react-slider";
|
|
3
|
-
declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> &
|
|
4
|
-
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" |
|
|
5
|
-
} &
|
|
6
|
-
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" |
|
|
7
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
8
|
-
} &
|
|
9
|
-
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" |
|
|
10
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
11
|
-
} &
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} &
|
|
3
|
+
declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
4
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
5
|
+
} & {
|
|
6
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
7
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
8
|
+
} & {
|
|
9
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
10
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
wide?: boolean | undefined;
|
|
13
|
+
disabled?: boolean | undefined;
|
|
14
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
15
15
|
export { Slider };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Switch: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> &
|
|
3
|
-
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
5
|
-
} &
|
|
2
|
+
declare const Switch: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref" | "type"> & {
|
|
3
|
+
variant?: "accent" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
5
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
6
6
|
export { Switch };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const TextField: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref"> &
|
|
3
|
-
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
outline?: boolean |
|
|
5
|
-
wide?: boolean |
|
|
6
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
7
|
-
} &
|
|
2
|
+
export declare const TextField: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLInputElement>, "size" | "ref"> & {
|
|
3
|
+
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
outline?: boolean | undefined;
|
|
5
|
+
wide?: boolean | undefined;
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
7
|
+
} & {
|
|
8
8
|
info?: React.ReactNode;
|
|
9
9
|
error?: string | string[] | null | undefined;
|
|
10
10
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare const Textarea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "ref"> &
|
|
3
|
-
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" |
|
|
4
|
-
outline?: boolean |
|
|
5
|
-
wide?: boolean |
|
|
6
|
-
size?: "xs" | "sm" | "md" | "lg" |
|
|
7
|
-
} &
|
|
2
|
+
declare const Textarea: React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size" | "ref"> & {
|
|
3
|
+
variant?: "accent" | "error" | "ghost" | "info" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
4
|
+
outline?: boolean | undefined;
|
|
5
|
+
wide?: boolean | undefined;
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
7
|
+
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
8
8
|
export { Textarea };
|
|
@@ -3,7 +3,7 @@ import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
|
3
3
|
import { PopoverProps } from "./types";
|
|
4
4
|
declare const Popover: {
|
|
5
5
|
(props: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
Content: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> &
|
|
6
|
+
Content: React.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & {} & React.RefAttributes<HTMLDivElement>>;
|
|
7
7
|
Trigger: React.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
8
|
};
|
|
9
9
|
export { Popover };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
|
-
export declare const Progress: React.ForwardRefExoticComponent<Omit<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref">, "asChild"> &
|
|
4
|
-
variant?: "accent" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" |
|
|
5
|
-
} &
|
|
3
|
+
export declare const Progress: React.ForwardRefExoticComponent<Omit<Omit<ProgressPrimitive.ProgressProps & React.RefAttributes<HTMLDivElement>, "ref">, "asChild"> & {
|
|
4
|
+
variant?: "accent" | "error" | "ghost" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | "base" | undefined;
|
|
5
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -3,9 +3,9 @@ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
|
3
3
|
import type { TooltipArrowProps } from "./types";
|
|
4
4
|
declare const Tooltip: {
|
|
5
5
|
(props: TooltipPrimitive.TooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
Content: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & TooltipPrimitive.TooltipContentProps &
|
|
7
|
-
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" |
|
|
8
|
-
} &
|
|
6
|
+
Content: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & TooltipPrimitive.TooltipContentProps & {
|
|
7
|
+
variant?: "accent" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
|
|
8
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
Arrow: ({ className, variant, ...props }: TooltipArrowProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
Portal: React.FC<TooltipPrimitive.TooltipPortalProps>;
|
|
11
11
|
Provider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
package/dist/types/libs/cva.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { type VariantProps as OriginalVariantProps } from "class-variance-authority";
|
|
2
|
+
export { cva } from "class-variance-authority";
|
|
3
|
+
type ExcludeNull<T> = {
|
|
4
|
+
[P in keyof T]: Exclude<T[P], null>;
|
|
5
|
+
};
|
|
6
|
+
export type VariantProps<T extends (...args: any) => any> = ExcludeNull<OriginalVariantProps<T>>;
|
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.10",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
"clsx": "^2.1.0",
|
|
77
77
|
"cmdk": "^1.0.0",
|
|
78
78
|
"daisyui": "^4.6.2",
|
|
79
|
+
"date-fns": "^3.6.0",
|
|
80
|
+
"react-day-picker": "^8.10.0",
|
|
79
81
|
"react-international-phone": "^4.2.6",
|
|
80
82
|
"tailwind-merge": "^2.2.1",
|
|
81
83
|
"tailwindcss-animate": "^1.0.7"
|
|
@@ -125,5 +127,5 @@
|
|
|
125
127
|
"react-dom": "^18.2.0",
|
|
126
128
|
"typescript": "^5.2.2"
|
|
127
129
|
},
|
|
128
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "ea8132bd773a0b14c438d7e4a6eb37b202b4a2aa"
|
|
129
131
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { DayPicker } from "react-day-picker";
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons";
|
|
5
|
+
import { type CalendarProps } from "./types";
|
|
6
|
+
import { cn } from "../../utilities";
|
|
7
|
+
import { getButtonClasses } from "../Button/constants";
|
|
8
|
+
|
|
9
|
+
export const Calendar = ({
|
|
10
|
+
className,
|
|
11
|
+
classNames,
|
|
12
|
+
showOutsideDays = true,
|
|
13
|
+
...props
|
|
14
|
+
}: CalendarProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<DayPicker
|
|
17
|
+
showOutsideDays={showOutsideDays}
|
|
18
|
+
className={cn("p-3", className)}
|
|
19
|
+
classNames={{
|
|
20
|
+
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
21
|
+
month: "space-y-4",
|
|
22
|
+
caption: "flex justify-center pt-1 relative items-center",
|
|
23
|
+
caption_label: "text-sm font-medium",
|
|
24
|
+
caption_dropdowns: "flex justify-center items-center",
|
|
25
|
+
nav: "space-x-1 flex items-center",
|
|
26
|
+
nav_button: cn(
|
|
27
|
+
getButtonClasses({ outline: true }),
|
|
28
|
+
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
29
|
+
),
|
|
30
|
+
nav_button_previous: "absolute left-1",
|
|
31
|
+
nav_button_next: "absolute right-1",
|
|
32
|
+
table: "w-full border-collapse space-y-1",
|
|
33
|
+
head_row: "flex",
|
|
34
|
+
head_cell:
|
|
35
|
+
"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
|
36
|
+
row: "flex w-full mt-2",
|
|
37
|
+
cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
|
|
38
|
+
day: cn(
|
|
39
|
+
getButtonClasses({ variant: "ghost" }),
|
|
40
|
+
"h-8 w-8 p-0 font-normal aria-selected:opacity-100"
|
|
41
|
+
),
|
|
42
|
+
day_range_end: "day-range-end",
|
|
43
|
+
day_selected:
|
|
44
|
+
"bg-primary text-primary-content disabled:bg-primary disabled:text-primary-content hover:bg-primary hover:text-primary-content focus:bg-primary focus:text-primary-content",
|
|
45
|
+
day_today: "outline outline-accent",
|
|
46
|
+
day_outside:
|
|
47
|
+
"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
|
|
48
|
+
day_disabled: "text-muted-foreground opacity-50",
|
|
49
|
+
day_range_middle:
|
|
50
|
+
"aria-selected:bg-accent aria-selected:text-accent-content",
|
|
51
|
+
day_hidden: "hidden",
|
|
52
|
+
vhidden: "hidden",
|
|
53
|
+
dropdown_month: "text-sm [&>[aria-hidden='true']]:hidden",
|
|
54
|
+
dropdown_year: "text-sm [&>[aria-hidden='true']]:hidden",
|
|
55
|
+
...classNames,
|
|
56
|
+
}}
|
|
57
|
+
components={{
|
|
58
|
+
IconLeft: () => <ChevronLeftIcon className="h-4 w-4" />,
|
|
59
|
+
IconRight: () => <ChevronRightIcon className="h-4 w-4" />,
|
|
60
|
+
}}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
Calendar.displayName = "Calendar";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Calendar } from "./Calendar";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { format } from "date-fns";
|
|
5
|
+
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
6
|
+
import { type DatePickerProps } from "./types";
|
|
7
|
+
import { cn } from "../../utilities";
|
|
8
|
+
import { Button } from "../Button";
|
|
9
|
+
import { Calendar } from "../Calendar";
|
|
10
|
+
import { Popover } from "../Popover";
|
|
11
|
+
|
|
12
|
+
export const DatePicker = ({
|
|
13
|
+
name,
|
|
14
|
+
size,
|
|
15
|
+
wide,
|
|
16
|
+
label,
|
|
17
|
+
outline,
|
|
18
|
+
variant,
|
|
19
|
+
disabled,
|
|
20
|
+
defaultDate,
|
|
21
|
+
getDateValue = (date) => date?.toUTCString(),
|
|
22
|
+
getDateLabel = (date) => (date ? format(date, "PPP") : undefined),
|
|
23
|
+
...props
|
|
24
|
+
}: DatePickerProps) => {
|
|
25
|
+
const [date, setDate] = useState<Date | undefined>(defaultDate);
|
|
26
|
+
|
|
27
|
+
const dateLabel = getDateLabel(date);
|
|
28
|
+
const dateValue = getDateValue(date);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<Popover>
|
|
32
|
+
<Popover.Trigger asChild>
|
|
33
|
+
<Button
|
|
34
|
+
name={name}
|
|
35
|
+
size={size}
|
|
36
|
+
wide={wide}
|
|
37
|
+
outline={outline}
|
|
38
|
+
variant={variant}
|
|
39
|
+
disabled={disabled}
|
|
40
|
+
className={cn("justify-start", !date && "font-normal")}
|
|
41
|
+
value={dateValue}
|
|
42
|
+
>
|
|
43
|
+
{dateLabel ?? <span>{label ?? "Pick a date"}</span>}
|
|
44
|
+
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
|
|
45
|
+
</Button>
|
|
46
|
+
</Popover.Trigger>
|
|
47
|
+
<Popover.Content className="w-auto p-0">
|
|
48
|
+
<Calendar
|
|
49
|
+
initialFocus
|
|
50
|
+
mode="single"
|
|
51
|
+
selected={date}
|
|
52
|
+
onSelect={setDate}
|
|
53
|
+
captionLayout="dropdown-buttons"
|
|
54
|
+
{...props}
|
|
55
|
+
/>
|
|
56
|
+
</Popover.Content>
|
|
57
|
+
</Popover>
|
|
58
|
+
);
|
|
59
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { format } from "date-fns";
|
|
5
|
+
import { type DateRange } from "react-day-picker";
|
|
6
|
+
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
7
|
+
import { type DateRangePickerProps } from "./types";
|
|
8
|
+
import { cn } from "../../utilities";
|
|
9
|
+
import { Button } from "../Button";
|
|
10
|
+
import { Calendar } from "../Calendar";
|
|
11
|
+
import { Popover } from "../Popover";
|
|
12
|
+
|
|
13
|
+
export const DateRangePicker = ({
|
|
14
|
+
name,
|
|
15
|
+
size,
|
|
16
|
+
wide,
|
|
17
|
+
label,
|
|
18
|
+
outline,
|
|
19
|
+
variant,
|
|
20
|
+
disabled,
|
|
21
|
+
defaultRange,
|
|
22
|
+
getRangeValue = (range) => ({
|
|
23
|
+
from: range?.from?.toUTCString(),
|
|
24
|
+
to: range?.to?.toUTCString(),
|
|
25
|
+
}),
|
|
26
|
+
getRangeLabel = (range) =>
|
|
27
|
+
range?.from ? (
|
|
28
|
+
range.to ? (
|
|
29
|
+
<>
|
|
30
|
+
{format(range.from, "LLL dd, y")} - {format(range.to, "LLL dd, y")}
|
|
31
|
+
</>
|
|
32
|
+
) : (
|
|
33
|
+
format(range.from, "LLL dd, y")
|
|
34
|
+
)
|
|
35
|
+
) : undefined,
|
|
36
|
+
...props
|
|
37
|
+
}: DateRangePickerProps) => {
|
|
38
|
+
const [range, setRange] = useState<DateRange | undefined>(defaultRange);
|
|
39
|
+
|
|
40
|
+
const rangeLabel = getRangeLabel(range);
|
|
41
|
+
const rangeValue = getRangeValue(range);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Popover>
|
|
45
|
+
{name && (
|
|
46
|
+
<>
|
|
47
|
+
<input
|
|
48
|
+
hidden
|
|
49
|
+
className="hidden"
|
|
50
|
+
aria-hidden="true"
|
|
51
|
+
name={`${name}.from`}
|
|
52
|
+
defaultValue={rangeValue.from}
|
|
53
|
+
/>
|
|
54
|
+
<input
|
|
55
|
+
hidden
|
|
56
|
+
className="hidden"
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
name={`${name}.to`}
|
|
59
|
+
defaultValue={rangeValue.to}
|
|
60
|
+
/>
|
|
61
|
+
</>
|
|
62
|
+
)}
|
|
63
|
+
<Popover.Trigger asChild>
|
|
64
|
+
<Button
|
|
65
|
+
name={name}
|
|
66
|
+
size={size}
|
|
67
|
+
wide={wide}
|
|
68
|
+
outline={outline}
|
|
69
|
+
variant={variant}
|
|
70
|
+
disabled={disabled}
|
|
71
|
+
className={cn("justify-start flex-nowrap", !range && "font-normal")}
|
|
72
|
+
>
|
|
73
|
+
<span className="text-left line-clamp-1">
|
|
74
|
+
{rangeLabel ?? label ?? "Pick a range"}
|
|
75
|
+
</span>
|
|
76
|
+
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
|
|
77
|
+
</Button>
|
|
78
|
+
</Popover.Trigger>
|
|
79
|
+
<Popover.Content className="w-auto p-0">
|
|
80
|
+
<Calendar
|
|
81
|
+
initialFocus
|
|
82
|
+
mode="range"
|
|
83
|
+
selected={range}
|
|
84
|
+
onSelect={setRange}
|
|
85
|
+
captionLayout="dropdown-buttons"
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
</Popover.Content>
|
|
89
|
+
</Popover>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { format } from "date-fns";
|
|
5
|
+
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
6
|
+
import { type MultipleDatesPickerProps } from "./types";
|
|
7
|
+
import { cn } from "../../utilities";
|
|
8
|
+
import { Button } from "../Button";
|
|
9
|
+
import { Calendar } from "../Calendar";
|
|
10
|
+
import { Popover } from "../Popover";
|
|
11
|
+
|
|
12
|
+
export const MultipleDatesPicker = ({
|
|
13
|
+
name,
|
|
14
|
+
size,
|
|
15
|
+
wide,
|
|
16
|
+
label,
|
|
17
|
+
outline,
|
|
18
|
+
variant,
|
|
19
|
+
disabled,
|
|
20
|
+
defaultDates,
|
|
21
|
+
getDatesValue = (dates) => dates?.map((date) => date.toUTCString()),
|
|
22
|
+
getDatesLabel = (dates) => {
|
|
23
|
+
if (!dates?.length) return undefined;
|
|
24
|
+
if (dates.length < 3)
|
|
25
|
+
return dates.map((date) => format(date, "LLL dd, y")).join(" and ");
|
|
26
|
+
|
|
27
|
+
return `${dates.length} dates selected`;
|
|
28
|
+
},
|
|
29
|
+
...props
|
|
30
|
+
}: MultipleDatesPickerProps) => {
|
|
31
|
+
const [dates, setDates] = useState<Date[] | undefined>(defaultDates);
|
|
32
|
+
|
|
33
|
+
const rangeLabel = getDatesLabel(dates);
|
|
34
|
+
const datesValues = getDatesValue(dates);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Popover>
|
|
38
|
+
{name &&
|
|
39
|
+
datesValues?.map((date, index) => (
|
|
40
|
+
<input
|
|
41
|
+
key={date}
|
|
42
|
+
hidden
|
|
43
|
+
className="hidden"
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
name={`${name}.${index}`}
|
|
46
|
+
defaultValue={date}
|
|
47
|
+
/>
|
|
48
|
+
))}
|
|
49
|
+
<Popover.Trigger asChild>
|
|
50
|
+
<Button
|
|
51
|
+
name={name}
|
|
52
|
+
size={size}
|
|
53
|
+
wide={wide}
|
|
54
|
+
outline={outline}
|
|
55
|
+
variant={variant}
|
|
56
|
+
disabled={disabled}
|
|
57
|
+
className={cn(
|
|
58
|
+
"justify-start flex-nowrap",
|
|
59
|
+
!dates?.length && "font-normal"
|
|
60
|
+
)}
|
|
61
|
+
>
|
|
62
|
+
<span className="text-left line-clamp-1">
|
|
63
|
+
{rangeLabel ?? label ?? "Pick one or more dates"}
|
|
64
|
+
</span>
|
|
65
|
+
<CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
|
|
66
|
+
</Button>
|
|
67
|
+
</Popover.Trigger>
|
|
68
|
+
<Popover.Content className="w-auto p-0">
|
|
69
|
+
<Calendar
|
|
70
|
+
initialFocus
|
|
71
|
+
mode="multiple"
|
|
72
|
+
selected={dates}
|
|
73
|
+
onSelect={setDates}
|
|
74
|
+
captionLayout="dropdown-buttons"
|
|
75
|
+
{...props}
|
|
76
|
+
/>
|
|
77
|
+
</Popover.Content>
|
|
78
|
+
</Popover>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DateRange,
|
|
3
|
+
DayPickerMultipleProps,
|
|
4
|
+
DayPickerRangeProps,
|
|
5
|
+
DayPickerSingleProps,
|
|
6
|
+
} from "react-day-picker";
|
|
7
|
+
import { ButtonProps } from "../Button/types";
|
|
8
|
+
|
|
9
|
+
type BaseDatePickerProps = Pick<
|
|
10
|
+
ButtonProps,
|
|
11
|
+
"variant" | "outline" | "wide" | "size" | "name" | "disabled"
|
|
12
|
+
> & {
|
|
13
|
+
label?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type DatePickerProps = BaseDatePickerProps &
|
|
17
|
+
Omit<DayPickerSingleProps, "mode" | "selected" | "onSelect"> & {
|
|
18
|
+
defaultDate?: Date;
|
|
19
|
+
getDateLabel?: (date: Date | undefined) => string | undefined;
|
|
20
|
+
getDateValue?: (date: Date | undefined) => string | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type DateRangePickerProps = BaseDatePickerProps &
|
|
24
|
+
Omit<DayPickerRangeProps, "mode" | "selected" | "onSelect"> & {
|
|
25
|
+
defaultRange?: DateRange;
|
|
26
|
+
getRangeValue?: (range: DateRange | undefined) => {
|
|
27
|
+
from: string | undefined;
|
|
28
|
+
to: string | undefined;
|
|
29
|
+
};
|
|
30
|
+
getRangeLabel?: (
|
|
31
|
+
range: DateRange | undefined
|
|
32
|
+
) => string | JSX.Element | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type MultipleDatesPickerProps = BaseDatePickerProps &
|
|
36
|
+
Omit<DayPickerMultipleProps, "mode" | "selected" | "onSelect"> & {
|
|
37
|
+
defaultDates?: Date[];
|
|
38
|
+
getDatesValue?: (dates: Date[] | undefined) => string[] | undefined;
|
|
39
|
+
getDatesLabel?: (
|
|
40
|
+
dates: Date[] | undefined
|
|
41
|
+
) => string | JSX.Element | undefined;
|
|
42
|
+
};
|
|
@@ -13,18 +13,19 @@ import { cn } from "../../../utilities";
|
|
|
13
13
|
import { Button } from "../../Button";
|
|
14
14
|
import { Input } from "../Input";
|
|
15
15
|
import { getPhoneButtonClasses, getPhoneInputClasses } from "./constants";
|
|
16
|
-
import { getInputClasses } from "../Input/constants";
|
|
17
|
-
import { getButtonClasses } from "../../Button/constants";
|
|
18
16
|
|
|
19
17
|
const Phone = React.forwardRef<HTMLInputElement, PhoneProps>(
|
|
20
18
|
(
|
|
21
19
|
{
|
|
20
|
+
disabled,
|
|
22
21
|
defaultValue,
|
|
23
22
|
className,
|
|
24
23
|
placeholder,
|
|
25
24
|
onChange,
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
variant,
|
|
26
|
+
outline,
|
|
27
|
+
wide,
|
|
28
|
+
size,
|
|
28
29
|
...props
|
|
29
30
|
},
|
|
30
31
|
ref
|
|
@@ -60,12 +61,16 @@ const Phone = React.forwardRef<HTMLInputElement, PhoneProps>(
|
|
|
60
61
|
<Button
|
|
61
62
|
role="combobox"
|
|
62
63
|
aria-expanded={open}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
)}
|
|
64
|
+
size={size}
|
|
65
|
+
variant={variant}
|
|
66
|
+
outline={outline}
|
|
67
|
+
className={cn(getPhoneButtonClasses())}
|
|
68
|
+
disabled={disabled}
|
|
67
69
|
>
|
|
68
|
-
<FlagImage
|
|
70
|
+
<FlagImage
|
|
71
|
+
iso2={country.iso2}
|
|
72
|
+
size={["xs", "sm"].includes(size!) ? "20px" : "30px"}
|
|
73
|
+
/>
|
|
69
74
|
</Button>
|
|
70
75
|
</Popover.Trigger>
|
|
71
76
|
<Popover.Content className="w-[200px] p-0">
|
|
@@ -104,11 +109,12 @@ const Phone = React.forwardRef<HTMLInputElement, PhoneProps>(
|
|
|
104
109
|
inputMode="numeric"
|
|
105
110
|
placeholder={placeholder ?? " "}
|
|
106
111
|
onChange={handleInputChange}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
size={size}
|
|
113
|
+
wide={wide}
|
|
114
|
+
variant={variant}
|
|
115
|
+
outline={outline}
|
|
116
|
+
disabled={disabled}
|
|
117
|
+
className={cn(getPhoneInputClasses(), className)}
|
|
112
118
|
{...props}
|
|
113
119
|
/>
|
|
114
120
|
</div>
|
|
@@ -3,5 +3,5 @@ import { cva } from "../../../libs";
|
|
|
3
3
|
export const getPhoneButtonClasses = cva("join-item justify-between px-2");
|
|
4
4
|
|
|
5
5
|
export const getPhoneInputClasses = cva(
|
|
6
|
-
"input join-item input-bordered
|
|
6
|
+
"input join-item input-bordered w-full !rounded-l-none !pl-2 transition-all duration-100"
|
|
7
7
|
);
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { type VariantProps } from "../../../libs";
|
|
2
1
|
import { type InputProps } from "../Input/types";
|
|
3
|
-
import { getInputClasses } from "../Input/constants";
|
|
4
|
-
import { getButtonClasses } from "../../Button/constants";
|
|
5
2
|
|
|
6
|
-
export type PhoneProps = Omit<
|
|
7
|
-
InputProps,
|
|
8
|
-
"type" | "size" | "label" | "inputMode"
|
|
9
|
-
> & {
|
|
10
|
-
inputProps?: VariantProps<typeof getInputClasses>;
|
|
11
|
-
buttonProps?: VariantProps<typeof getButtonClasses>;
|
|
12
|
-
};
|
|
3
|
+
export type PhoneProps = Omit<InputProps, "type" | "label" | "inputMode">;
|
|
@@ -57,7 +57,7 @@ export const getSelectLabelClasses = cva("px-2 py-1.5 text-sm font-semibold");
|
|
|
57
57
|
export const getSelectSeparatorClasses = cva("-mx-1 my-1 h-px bg-muted");
|
|
58
58
|
|
|
59
59
|
export const getSelectContentClasses = cva(
|
|
60
|
-
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-
|
|
60
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-base-100 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
61
61
|
{
|
|
62
62
|
variants: {
|
|
63
63
|
position: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cva } from "../../libs";
|
|
2
2
|
|
|
3
3
|
export const getPopoverContentClasses = cva(
|
|
4
|
-
"z-50 w-72 rounded-md border bg-
|
|
4
|
+
"z-50 w-72 rounded-md border bg-base-100 p-4 shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"
|
|
5
5
|
);
|
package/src/libs/cva.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { type VariantProps as OriginalVariantProps } from "class-variance-authority";
|
|
2
|
+
|
|
3
|
+
export { cva } from "class-variance-authority";
|
|
4
|
+
|
|
5
|
+
type ExcludeNull<T> = { [P in keyof T]: Exclude<T[P], null> };
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
export type VariantProps<T extends (...args: any) => any> = ExcludeNull<
|
|
9
|
+
OriginalVariantProps<T>
|
|
10
|
+
>;
|