@mbao01/common 0.0.47 → 0.0.49
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/Command/Command.d.ts +6 -6
- package/dist/types/components/Form/MultiSelect/MultiSelect.d.ts +2 -2
- package/dist/types/components/Sidebar/Sidebar.d.ts +39 -0
- package/dist/types/components/Sidebar/SidebarContext.d.ts +2 -0
- package/dist/types/components/Sidebar/SidebarGroup.d.ts +13 -0
- package/dist/types/components/Sidebar/SidebarMenu.d.ts +30 -0
- package/dist/types/components/Sidebar/constants.d.ts +48 -0
- package/dist/types/components/Sidebar/hooks/index.d.ts +1 -0
- package/dist/types/components/Sidebar/hooks/useSidebar/index.d.ts +1 -0
- package/dist/types/components/Sidebar/hooks/useSidebar/useSidebar.d.ts +1 -0
- package/dist/types/components/Sidebar/index.d.ts +4 -0
- package/dist/types/components/Sidebar/stories/examples/Sidebar.example.d.ts +57 -0
- package/dist/types/components/Sidebar/stories/examples/components/AppMain.d.ts +3 -0
- package/dist/types/components/Sidebar/stories/examples/components/AppSidebar.d.ts +6 -0
- package/dist/types/components/Sidebar/stories/examples/components/SearchForm.d.ts +1 -0
- package/dist/types/components/Sidebar/stories/examples/components/VersionSwitcher.d.ts +4 -0
- package/dist/types/components/Sidebar/types.d.ts +55 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useIsMobile/index.d.ts +1 -0
- package/dist/types/hooks/useIsMobile/useIsMobile.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +6 -6
- package/src/components/Anchor/Anchor.tsx +2 -2
- package/src/components/Calendar/Calendar.tsx +1 -1
- package/src/components/Carousel/Carousel.tsx +1 -1
- package/src/components/Chart/stories/examples/LineChart.tsx +2 -2
- package/src/components/Combobox/Combobox.tsx +2 -2
- package/src/components/Command/Command.tsx +2 -2
- package/src/components/DatePicker/DatePicker.tsx +2 -2
- package/src/components/DatePicker/DateRangePicker.tsx +2 -2
- package/src/components/DatePicker/MultipleDatesPicker.tsx +2 -2
- package/src/components/Dialog/Dialog.tsx +2 -2
- package/src/components/FileUploader/FileUploader.tsx +2 -2
- package/src/components/Form/DatetimeInput/DatetimeCalendar.tsx +2 -2
- package/src/components/Form/MultiSelect/MultiSelect.tsx +2 -2
- package/src/components/Form/Select/Select.tsx +1 -1
- package/src/components/Form/TagsInput/TagsInput.tsx +2 -2
- package/src/components/Menu/ContextMenu/ContextMenu.tsx +2 -2
- package/src/components/Menu/DropdownMenu/DropdownMenu.tsx +2 -2
- package/src/components/Menu/Menubar/Menubar.tsx +2 -2
- package/src/components/Menu/NavigationMenu/NavigationMenu.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +2 -2
- package/src/components/Sidebar/Sidebar.tsx +326 -0
- package/src/components/Sidebar/SidebarContext.tsx +6 -0
- package/src/components/Sidebar/SidebarGroup.tsx +72 -0
- package/src/components/Sidebar/SidebarMenu.tsx +205 -0
- package/src/components/Sidebar/constants.ts +206 -0
- package/src/components/Sidebar/hooks/index.ts +1 -0
- package/src/components/Sidebar/hooks/useSidebar/index.ts +1 -0
- package/src/components/Sidebar/hooks/useSidebar/useSidebar.ts +11 -0
- package/src/components/Sidebar/index.ts +4 -0
- package/src/components/Sidebar/stories/examples/Sidebar.example.tsx +155 -0
- package/src/components/Sidebar/stories/examples/components/AppMain.tsx +36 -0
- package/src/components/Sidebar/stories/examples/components/AppSidebar.tsx +531 -0
- package/src/components/Sidebar/stories/examples/components/SearchForm.tsx +26 -0
- package/src/components/Sidebar/stories/examples/components/VersionSwitcher.tsx +45 -0
- package/src/components/Sidebar/types.ts +74 -0
- package/src/components/Widget/Widgets.example.tsx +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useIsMobile/index.ts +1 -0
- package/src/hooks/useIsMobile/useIsMobile.ts +19 -0
- package/src/index.ts +3 -0
|
@@ -8,7 +8,7 @@ declare const Command: {
|
|
|
8
8
|
ref?: React.Ref<HTMLInputElement>;
|
|
9
9
|
} & {
|
|
10
10
|
asChild?: boolean;
|
|
11
|
-
}, "
|
|
11
|
+
}, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "onChange" | "value"> & {
|
|
12
12
|
value?: string;
|
|
13
13
|
onValueChange?: (search: string) => void;
|
|
14
14
|
} & React.RefAttributes<HTMLInputElement>, "ref"> & {} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -18,7 +18,7 @@ declare const Command: {
|
|
|
18
18
|
ref?: React.Ref<HTMLDivElement>;
|
|
19
19
|
} & {
|
|
20
20
|
asChild?: boolean;
|
|
21
|
-
}, "
|
|
21
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
22
22
|
label?: string;
|
|
23
23
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
24
24
|
Empty: React.ForwardRefExoticComponent<Omit<{
|
|
@@ -27,14 +27,14 @@ declare const Command: {
|
|
|
27
27
|
ref?: React.Ref<HTMLDivElement>;
|
|
28
28
|
} & {
|
|
29
29
|
asChild?: boolean;
|
|
30
|
-
}, "
|
|
30
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
31
31
|
Group: React.ForwardRefExoticComponent<Omit<{
|
|
32
32
|
children?: React.ReactNode;
|
|
33
33
|
} & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
34
34
|
ref?: React.Ref<HTMLDivElement>;
|
|
35
35
|
} & {
|
|
36
36
|
asChild?: boolean;
|
|
37
|
-
}, "
|
|
37
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
|
|
38
38
|
heading?: React.ReactNode;
|
|
39
39
|
value?: string;
|
|
40
40
|
forceMount?: boolean;
|
|
@@ -45,7 +45,7 @@ declare const Command: {
|
|
|
45
45
|
ref?: React.Ref<HTMLDivElement>;
|
|
46
46
|
} & {
|
|
47
47
|
asChild?: boolean;
|
|
48
|
-
}, "
|
|
48
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
|
|
49
49
|
disabled?: boolean;
|
|
50
50
|
onSelect?: (value: string) => void;
|
|
51
51
|
value?: string;
|
|
@@ -60,7 +60,7 @@ declare const Command: {
|
|
|
60
60
|
ref?: React.Ref<HTMLDivElement>;
|
|
61
61
|
} & {
|
|
62
62
|
asChild?: boolean;
|
|
63
|
-
}, "
|
|
63
|
+
}, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
|
|
64
64
|
alwaysRender?: boolean;
|
|
65
65
|
} & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
66
66
|
};
|
|
@@ -16,7 +16,7 @@ declare const MultiSelect: {
|
|
|
16
16
|
ref?: React.Ref<HTMLDivElement>;
|
|
17
17
|
} & {
|
|
18
18
|
asChild?: boolean;
|
|
19
|
-
}, "
|
|
19
|
+
}, "key" | "asChild" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
|
|
20
20
|
label?: string;
|
|
21
21
|
} & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & {
|
|
22
22
|
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
@@ -27,7 +27,7 @@ declare const MultiSelect: {
|
|
|
27
27
|
ref?: React.Ref<HTMLDivElement>;
|
|
28
28
|
} & {
|
|
29
29
|
asChild?: boolean;
|
|
30
|
-
}, "
|
|
30
|
+
}, "key" | "asChild" | keyof import('react').HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
onSelect?: (value: string) => void;
|
|
33
33
|
value?: string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { SeparatorProps } from '../Separator/types';
|
|
3
|
+
import { SidebarProps } from './types';
|
|
4
|
+
declare const Sidebar: {
|
|
5
|
+
({ side, variant, collapsible, className, children, ...props }: SidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
Content: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
|
|
8
|
+
Footer: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
|
+
Header: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import('react').RefAttributes<HTMLDivElement>>;
|
|
10
|
+
Input: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLProps<HTMLInputElement>, "ref" | "size"> & Omit<{
|
|
11
|
+
variant?: "accent" | "default" | "error" | "info" | "primary" | "secondary" | "success" | "warning" | "ghost" | undefined;
|
|
12
|
+
type?: string | number | undefined;
|
|
13
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
14
|
+
outline?: boolean | undefined;
|
|
15
|
+
wide?: boolean | undefined;
|
|
16
|
+
}, "type"> & import('react').RefAttributes<HTMLInputElement>>;
|
|
17
|
+
Inset: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
18
|
+
Provider: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
open?: boolean;
|
|
21
|
+
onOpenChange?: (open: boolean) => void;
|
|
22
|
+
tooltipProvider?: import('@radix-ui/react-tooltip').TooltipProviderProps;
|
|
23
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
24
|
+
Rail: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
25
|
+
Separator: {
|
|
26
|
+
({ className, ...props }: SeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
Trigger: import('react').ForwardRefExoticComponent<import('react').ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
30
|
+
variant?: "accent" | "default" | "error" | "info" | "link" | "neutral" | "primary" | "secondary" | "success" | "warning" | "ghost" | undefined;
|
|
31
|
+
size?: "xs" | "sm" | "md" | "lg" | undefined;
|
|
32
|
+
outline?: boolean | undefined;
|
|
33
|
+
wide?: boolean | undefined;
|
|
34
|
+
isLoading?: boolean | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
asChild?: boolean;
|
|
37
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
};
|
|
39
|
+
export { Sidebar };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SidebarGroupContentProps, SidebarGroupProps } from './types';
|
|
2
|
+
declare const SidebarGroup: {
|
|
3
|
+
({ className, ...props }: SidebarGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
Action: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLButtonElement> & Partial<{
|
|
6
|
+
asChild: boolean;
|
|
7
|
+
}> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
Content: import('react').ForwardRefExoticComponent<SidebarGroupContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
9
|
+
Label: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & Partial<{
|
|
10
|
+
asChild: boolean;
|
|
11
|
+
}> & import('react').RefAttributes<HTMLDivElement>>;
|
|
12
|
+
};
|
|
13
|
+
export { SidebarGroup };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SidebarMenuBadgeProps, SidebarMenuItemProps, SidebarMenuProps, SidebarMenuSubItemProps, SidebarMenuSubProps } from './types';
|
|
2
|
+
declare const SidebarMenu: {
|
|
3
|
+
({ className, ...props }: SidebarMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
Item: import('react').ForwardRefExoticComponent<SidebarMenuItemProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
6
|
+
Button: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLButtonElement> & Partial<{
|
|
7
|
+
asChild: boolean;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
tooltip: string | import('../Tooltip/types').TooltipContentProps;
|
|
10
|
+
}> & {
|
|
11
|
+
variant?: "default" | "outline" | undefined;
|
|
12
|
+
size?: "default" | "sm" | "lg" | undefined;
|
|
13
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
Action: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLButtonElement> & Partial<{
|
|
15
|
+
asChild: boolean;
|
|
16
|
+
showOnHover: boolean;
|
|
17
|
+
}> & import('react').RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
Badge: import('react').ForwardRefExoticComponent<SidebarMenuBadgeProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
19
|
+
Skeleton: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLDivElement> & Partial<{
|
|
20
|
+
showIcon: boolean;
|
|
21
|
+
}> & import('react').RefAttributes<HTMLDivElement>>;
|
|
22
|
+
Sub: import('react').ForwardRefExoticComponent<SidebarMenuSubProps & import('react').RefAttributes<HTMLUListElement>>;
|
|
23
|
+
SubItem: import('react').ForwardRefExoticComponent<SidebarMenuSubItemProps & import('react').RefAttributes<HTMLLIElement>>;
|
|
24
|
+
SubButton: import('react').ForwardRefExoticComponent<import('react').HTMLAttributes<HTMLAnchorElement> & Partial<{
|
|
25
|
+
asChild: boolean;
|
|
26
|
+
size: "sm" | "md";
|
|
27
|
+
isActive: boolean;
|
|
28
|
+
}> & import('react').RefAttributes<HTMLAnchorElement>>;
|
|
29
|
+
};
|
|
30
|
+
export { SidebarMenu };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const SIDEBAR_COOKIE_NAME = "sidebar:state";
|
|
2
|
+
export declare const SIDEBAR_COOKIE_MAX_AGE: number;
|
|
3
|
+
export declare const SIDEBAR_WIDTH = "16rem";
|
|
4
|
+
export declare const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
5
|
+
export declare const SIDEBAR_WIDTH_ICON = "3rem";
|
|
6
|
+
export declare const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
7
|
+
export declare const getSidebarClasses: (props?: ({
|
|
8
|
+
collapsible?: "none" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export declare const getSidebarMobileClasses: (props?: ({
|
|
11
|
+
isMobile?: boolean | null | undefined;
|
|
12
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
13
|
+
export declare const getSidebarOuterClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
14
|
+
export declare const getSidebarInnerClasses: (props?: ({
|
|
15
|
+
side?: "right" | "left" | null | undefined;
|
|
16
|
+
variant?: "inset" | "floating" | "sidebar" | null | undefined;
|
|
17
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
18
|
+
export declare const getSidebarGapClasses: (props?: ({
|
|
19
|
+
variant?: "inset" | "floating" | "sidebar" | null | undefined;
|
|
20
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
21
|
+
export declare const getSidebarTriggerClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
22
|
+
export declare const getSidebarRailClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
23
|
+
export declare const getSidebarInsetClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
24
|
+
export declare const getSidebarInputClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
25
|
+
export declare const getSidebarHeaderClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
26
|
+
export declare const getSidebarFooterClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
27
|
+
export declare const getSidebarSeparatorClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
28
|
+
export declare const getSidebarContentClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
29
|
+
export declare const getSidebarProviderClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
30
|
+
export declare const getSidebarGroupClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
31
|
+
export declare const getSidebarGroupLabelClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
32
|
+
export declare const getSidebarGroupActionClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
33
|
+
export declare const getSidebarGroupContentClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
34
|
+
export declare const getSidebarMenuClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
35
|
+
export declare const getSidebarMenuItemClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
36
|
+
export declare const getSidebarMenuButtonClasses: (props?: ({
|
|
37
|
+
variant?: "default" | "outline" | null | undefined;
|
|
38
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
39
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
40
|
+
export declare const getSidebarMenuActionClasses: (props?: ({
|
|
41
|
+
showOnHover?: boolean | null | undefined;
|
|
42
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
43
|
+
export declare const getSidebarMenuBadgeClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
44
|
+
export declare const getSidebarMenuSkeletonClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
45
|
+
export declare const getSidebarMenuSubClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
46
|
+
export declare const getSidebarMenuSubItemClasses: (props?: ({
|
|
47
|
+
size?: "sm" | "md" | null | undefined;
|
|
48
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSidebar } from './useSidebar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSidebar } from './useSidebar';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSidebar: () => import('../../types').SidebarContextProps;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SidebarProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Here's the basic style setup. In your css file e.g tailwind.css, add
|
|
4
|
+
*
|
|
5
|
+
```css
|
|
6
|
+
\@layer base {
|
|
7
|
+
:root {
|
|
8
|
+
--sidebar-background: 0 0% 98%;
|
|
9
|
+
--sidebar-foreground: 240 5.3% 26.1%;
|
|
10
|
+
--sidebar-primary: 240 5.9% 10%;
|
|
11
|
+
--sidebar-primary-foreground: 0 0% 98%;
|
|
12
|
+
--sidebar-accent: 240 4.8% 95.9%;
|
|
13
|
+
--sidebar-accent-foreground: 240 5.9% 10%;
|
|
14
|
+
--sidebar-border: 220 13% 91%;
|
|
15
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dark {
|
|
19
|
+
--sidebar-background: 240 5.9% 10%;
|
|
20
|
+
--sidebar-foreground: 240 4.8% 95.9%;
|
|
21
|
+
--sidebar-primary: 224.3 76.3% 48%;
|
|
22
|
+
--sidebar-primary-foreground: 0 0% 100%;
|
|
23
|
+
--sidebar-accent: 240 3.7% 15.9%;
|
|
24
|
+
--sidebar-accent-foreground: 240 4.8% 95.9%;
|
|
25
|
+
--sidebar-border: 240 3.7% 15.9%;
|
|
26
|
+
--sidebar-ring: 217.2 91.2% 59.8%;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
*
|
|
31
|
+
* then add this config in tailwind.config.ts
|
|
32
|
+
*
|
|
33
|
+
```js
|
|
34
|
+
{
|
|
35
|
+
sidebar: {
|
|
36
|
+
DEFAULT: 'hsl(var(--sidebar-background))',
|
|
37
|
+
foreground: 'hsl(var(--sidebar-foreground))',
|
|
38
|
+
primary: 'hsl(var(--sidebar-primary))',
|
|
39
|
+
'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
|
|
40
|
+
accent: 'hsl(var(--sidebar-accent))',
|
|
41
|
+
'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
|
|
42
|
+
border: 'hsl(var(--sidebar-border))',
|
|
43
|
+
ring: 'hsl(var(--sidebar-ring))',
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
* @param props
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
export declare const SidebarExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare const SidebarWithCollapsibleGroupExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
export declare const SidebarWithSubMenuExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export declare const SidebarWithSecondaryNavigationExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export declare const SidebarWithCollapsibleTreeExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
55
|
+
export declare const SidebarInADialogExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare const SidebarOnTheRightExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export declare const SidebarLeftAndRightExample: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SidebarProps } from '../../../types';
|
|
2
|
+
export declare const AppSidebar: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const AppSidebarWithCollapsibleGroup: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const AppSidebarWithSubMenu: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const AppSidebarWithSecondaryNavigation: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const AppSidebarCollapsibleTree: (props: SidebarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SearchForm: ({ ...props }: React.ComponentProps<"form">) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TooltipProviderProps } from '@radix-ui/react-tooltip';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
3
|
+
import { VariantProps } from '../../libs';
|
|
4
|
+
import { TooltipContentProps } from '../Tooltip/types';
|
|
5
|
+
import { getSidebarMenuButtonClasses } from './constants';
|
|
6
|
+
export type SidebarContextProps = {
|
|
7
|
+
state: "expanded" | "collapsed";
|
|
8
|
+
open: boolean;
|
|
9
|
+
setOpen: (open: boolean) => void;
|
|
10
|
+
openMobile: boolean;
|
|
11
|
+
setOpenMobile: (open: boolean) => void;
|
|
12
|
+
isMobile: boolean;
|
|
13
|
+
toggleSidebar: () => void;
|
|
14
|
+
};
|
|
15
|
+
export type SidebarProps = HTMLAttributes<HTMLDivElement> & Partial<{
|
|
16
|
+
side: "left" | "right";
|
|
17
|
+
variant: "sidebar" | "floating" | "inset";
|
|
18
|
+
collapsible: "offcanvas" | "icon" | "none";
|
|
19
|
+
}>;
|
|
20
|
+
export type SidebarProviderProps = HTMLAttributes<HTMLDivElement> & {
|
|
21
|
+
defaultOpen?: boolean;
|
|
22
|
+
open?: boolean;
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
tooltipProvider?: TooltipProviderProps;
|
|
25
|
+
};
|
|
26
|
+
export type SidebarGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
27
|
+
export type SidebarGroupLabelProps = HTMLAttributes<HTMLDivElement> & Partial<{
|
|
28
|
+
asChild: boolean;
|
|
29
|
+
}>;
|
|
30
|
+
export type SidebarGroupActionProps = HTMLAttributes<HTMLButtonElement> & Partial<{
|
|
31
|
+
asChild: boolean;
|
|
32
|
+
}>;
|
|
33
|
+
export type SidebarGroupContentProps = HTMLAttributes<HTMLDivElement>;
|
|
34
|
+
export type SidebarMenuProps = HTMLAttributes<HTMLUListElement>;
|
|
35
|
+
export type SidebarMenuItemProps = HTMLAttributes<HTMLLIElement>;
|
|
36
|
+
export type SidebarMenuButtonProps = HTMLAttributes<HTMLButtonElement> & Partial<{
|
|
37
|
+
asChild: boolean;
|
|
38
|
+
isActive: boolean;
|
|
39
|
+
tooltip: string | TooltipContentProps;
|
|
40
|
+
}> & VariantProps<typeof getSidebarMenuButtonClasses>;
|
|
41
|
+
export type SidebarMenuActionProps = HTMLAttributes<HTMLButtonElement> & Partial<{
|
|
42
|
+
asChild: boolean;
|
|
43
|
+
showOnHover: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
export type SidebarMenuBadgeProps = HTMLAttributes<HTMLDivElement>;
|
|
46
|
+
export type SidebarMenuSkeletonProps = HTMLAttributes<HTMLDivElement> & Partial<{
|
|
47
|
+
showIcon: boolean;
|
|
48
|
+
}>;
|
|
49
|
+
export type SidebarMenuSubProps = HTMLAttributes<HTMLUListElement>;
|
|
50
|
+
export type SidebarMenuSubItemProps = HTMLAttributes<HTMLLIElement>;
|
|
51
|
+
export type SidebarMenuSubButtonProps = HTMLAttributes<HTMLAnchorElement> & Partial<{
|
|
52
|
+
asChild: boolean;
|
|
53
|
+
size: "sm" | "md";
|
|
54
|
+
isActive: boolean;
|
|
55
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useIsMobile } from './useIsMobile';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useIsMobile } from './useIsMobile';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsMobile: () => boolean;
|
package/dist/types/index.d.ts
CHANGED
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.49",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Ayomide Bakare",
|
|
7
7
|
"license": "MIT",
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
82
82
|
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
|
83
83
|
"@radix-ui/react-hover-card": "^1.1.2",
|
|
84
|
-
"@radix-ui/react-icons": "^1.3.0",
|
|
85
84
|
"@radix-ui/react-label": "^2.1.0",
|
|
86
85
|
"@radix-ui/react-menubar": "^1.1.2",
|
|
87
86
|
"@radix-ui/react-navigation-menu": "^1.2.1",
|
|
@@ -102,7 +101,10 @@
|
|
|
102
101
|
"clsx": "^2.1.1",
|
|
103
102
|
"cmdk": "^1.0.0",
|
|
104
103
|
"daisyui": "^4.12.13",
|
|
104
|
+
"date-fns": "^4.1.0",
|
|
105
105
|
"embla-carousel-react": "^8.3.0",
|
|
106
|
+
"lucide-react": "^0.453.0",
|
|
107
|
+
"react-day-picker": "^9.2.0",
|
|
106
108
|
"react-dropzone": "^14.2.10",
|
|
107
109
|
"react-international-phone": "^4.3.0",
|
|
108
110
|
"react-otp-input": "^3.1.1",
|
|
@@ -110,6 +112,7 @@
|
|
|
110
112
|
"sonner": "^1.5.0",
|
|
111
113
|
"tailwind-merge": "^2.5.4",
|
|
112
114
|
"tailwindcss-animate": "^1.0.7",
|
|
115
|
+
"timescape": "^0.6.1",
|
|
113
116
|
"universal-cookie": "^7.2.1",
|
|
114
117
|
"vaul": "^1.1.0"
|
|
115
118
|
},
|
|
@@ -143,7 +146,6 @@
|
|
|
143
146
|
"@vitest/ui": "^2.1.3",
|
|
144
147
|
"autoprefixer": "^10.4.20",
|
|
145
148
|
"axe-playwright": "^2.0.3",
|
|
146
|
-
"date-fns": "^4.1.0",
|
|
147
149
|
"eslint": "^8.57.1",
|
|
148
150
|
"eslint-plugin-react": "^7.37.2",
|
|
149
151
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
@@ -155,12 +157,10 @@
|
|
|
155
157
|
"postcss": "^8.4.47",
|
|
156
158
|
"prettier": "^3.3.3",
|
|
157
159
|
"react": "^18.3.1",
|
|
158
|
-
"react-day-picker": "^9.2.0",
|
|
159
160
|
"react-dom": "^18.3.1",
|
|
160
161
|
"react-router-dom": "^6.27.0",
|
|
161
162
|
"storybook": "^8.3.6",
|
|
162
163
|
"tailwindcss": "^3.4.14",
|
|
163
|
-
"timescape": "^0.6.1",
|
|
164
164
|
"typescript": "^5.6.3",
|
|
165
165
|
"vite": "^5.4.10",
|
|
166
166
|
"vite-plugin-dts": "^4.3.0",
|
|
@@ -171,5 +171,5 @@
|
|
|
171
171
|
"react-dom": "^18.2.0",
|
|
172
172
|
"typescript": "^5.2.2"
|
|
173
173
|
},
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "86697af331eb24f58fb8689ebd8ca76d302ad387"
|
|
175
175
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ExternalLinkIcon } from "
|
|
1
|
+
import { ExternalLinkIcon } from "lucide-react";
|
|
2
2
|
import { cn } from "../../utilities";
|
|
3
3
|
import { getAnchorClasses } from "./constant";
|
|
4
4
|
import { type AnchorProps } from "./types";
|
|
@@ -21,7 +21,7 @@ export const Anchor = ({
|
|
|
21
21
|
{...(isExternal && { rel: "noopener noreferrer" })}
|
|
22
22
|
>
|
|
23
23
|
{children}
|
|
24
|
-
{isExternal ? <ExternalLinkIcon name="external" className="ml-[2px] inline" /> : null}
|
|
24
|
+
{isExternal ? <ExternalLinkIcon name="external" className="ml-[2px] inline w-4 h-4" /> : null}
|
|
25
25
|
</a>
|
|
26
26
|
);
|
|
27
27
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { DayPicker } from "react-day-picker";
|
|
4
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "
|
|
4
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
5
5
|
import { cn } from "../../utilities";
|
|
6
6
|
import { getButtonClasses } from "../Button/constants";
|
|
7
7
|
import { type CalendarProps } from "./types";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useState } from "react";
|
|
4
|
-
import { ArrowLeftIcon, ArrowRightIcon } from "@radix-ui/react-icons";
|
|
5
4
|
import useEmblaCarousel from "embla-carousel-react";
|
|
5
|
+
import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react";
|
|
6
6
|
import type { CarouselApi, CarouselProps } from "./types";
|
|
7
7
|
import { cn } from "../../utilities";
|
|
8
8
|
import { Button } from "../Button";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SVGProps } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { MapPinIcon } from "lucide-react";
|
|
3
3
|
import { CartesianGrid, LabelList, Line, LineChart, XAxis, YAxis } from "recharts";
|
|
4
4
|
import { Chart } from "../../Chart";
|
|
5
5
|
import {
|
|
@@ -85,7 +85,7 @@ export const CustomDotLineChartExample = (props: LineChartProps) => {
|
|
|
85
85
|
}: SVGProps<SVGSVGElement> & { payload: Record<string, string> }) => {
|
|
86
86
|
const r = 24;
|
|
87
87
|
return (
|
|
88
|
-
<
|
|
88
|
+
<MapPinIcon
|
|
89
89
|
key={payload.month}
|
|
90
90
|
x={Number(cx) - r / 4}
|
|
91
91
|
y={Number(cy) - r / 4}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
|
|
5
5
|
import type { ComboboxProps, Item } from "./types";
|
|
6
6
|
import { cn } from "../../utilities";
|
|
7
7
|
import { Button } from "../Button";
|
|
@@ -34,7 +34,7 @@ export const Combobox = <T extends Item>({
|
|
|
34
34
|
className={cn("justify-between", classes?.trigger)}
|
|
35
35
|
>
|
|
36
36
|
{value && currentItem ? getItemLabel(currentItem) : label}
|
|
37
|
-
<
|
|
37
|
+
<ChevronsUpDownIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
38
38
|
</Button>
|
|
39
39
|
</Popover.Trigger>
|
|
40
40
|
<Popover.Content className={cn("w-[200px] p-0", classes?.popoverContent)}>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
|
|
5
4
|
import { Command as CommandPrimitive } from "cmdk";
|
|
5
|
+
import { SearchIcon } from "lucide-react";
|
|
6
6
|
import type { CommandDialogProps, CommandInputProps, CommandProps } from "./types";
|
|
7
7
|
import { cn } from "../../utilities";
|
|
8
8
|
import { Dialog } from "../Dialog";
|
|
@@ -41,7 +41,7 @@ const CommandInput = React.forwardRef<
|
|
|
41
41
|
>(({ className, ...props }, ref) => (
|
|
42
42
|
// eslint-disable-next-line react/no-unknown-property
|
|
43
43
|
<div className={cn(getCommandInputWrapperClasses())} cmdk-input-wrapper="">
|
|
44
|
-
<
|
|
44
|
+
<SearchIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
|
|
45
45
|
<CommandPrimitive.Input
|
|
46
46
|
ref={ref}
|
|
47
47
|
className={cn(getCommandInputClasses(), className)}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
5
4
|
import { format } from "date-fns";
|
|
5
|
+
import { CalendarDaysIcon } from "lucide-react";
|
|
6
6
|
import { cn } from "../../utilities";
|
|
7
7
|
import { Button } from "../Button";
|
|
8
8
|
import { Calendar } from "../Calendar";
|
|
@@ -54,7 +54,7 @@ export const DatePicker = ({
|
|
|
54
54
|
value={dateValue}
|
|
55
55
|
>
|
|
56
56
|
{dateLabel ?? <span>{label ?? "Pick a date"}</span>}
|
|
57
|
-
<
|
|
57
|
+
<CalendarDaysIcon className="ml-auto h-4 w-4 opacity-50" />
|
|
58
58
|
</Button>
|
|
59
59
|
</Popover.Trigger>
|
|
60
60
|
<Popover.Content
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { type DateRange } from "react-day-picker";
|
|
5
|
-
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
6
5
|
import { format } from "date-fns";
|
|
6
|
+
import { CalendarDaysIcon } from "lucide-react";
|
|
7
7
|
import { cn } from "../../utilities";
|
|
8
8
|
import { Button } from "../Button";
|
|
9
9
|
import { Calendar } from "../Calendar";
|
|
@@ -74,7 +74,7 @@ export const DateRangePicker = ({
|
|
|
74
74
|
<span className="text-left text-ellipsis overflow-hidden text-nowrap">
|
|
75
75
|
{rangeLabel ?? label ?? "Pick a range"}
|
|
76
76
|
</span>
|
|
77
|
-
<
|
|
77
|
+
<CalendarDaysIcon className="ml-auto h-4 w-4 opacity-50" />
|
|
78
78
|
</Button>
|
|
79
79
|
</Popover.Trigger>
|
|
80
80
|
<Popover.Content className="w-auto p-0">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import { CalendarIcon } from "@radix-ui/react-icons";
|
|
5
4
|
import { format } from "date-fns";
|
|
5
|
+
import { CalendarDaysIcon } from "lucide-react";
|
|
6
6
|
import { cn } from "../../utilities";
|
|
7
7
|
import { Button } from "../Button";
|
|
8
8
|
import { Calendar } from "../Calendar";
|
|
@@ -58,7 +58,7 @@ export const MultipleDatesPicker = ({
|
|
|
58
58
|
<span className="text-left text-ellipsis overflow-hidden text-nowrap">
|
|
59
59
|
{rangeLabel ?? label ?? "Pick one or more dates"}
|
|
60
60
|
</span>
|
|
61
|
-
<
|
|
61
|
+
<CalendarDaysIcon className="ml-auto h-4 w-4 opacity-50" />
|
|
62
62
|
</Button>
|
|
63
63
|
</Popover.Trigger>
|
|
64
64
|
<Popover.Content className="w-auto p-0">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
5
|
-
import {
|
|
5
|
+
import { XIcon } from "lucide-react";
|
|
6
6
|
import type {
|
|
7
7
|
DialogContentProps,
|
|
8
8
|
DialogDescriptionProps,
|
|
@@ -72,7 +72,7 @@ const DialogContent = React.forwardRef<
|
|
|
72
72
|
{...closeProps}
|
|
73
73
|
className={cn(getDialogCloseClasses(), closeProps?.className)}
|
|
74
74
|
>
|
|
75
|
-
<
|
|
75
|
+
<XIcon className="h-4 w-4" />
|
|
76
76
|
<span className="sr-only">Close</span>
|
|
77
77
|
</DialogPrimitive.Close>
|
|
78
78
|
) : null}
|