@mbao01/common 0.0.48 → 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.
Files changed (62) hide show
  1. package/dist/types/components/Command/Command.d.ts +6 -6
  2. package/dist/types/components/Form/MultiSelect/MultiSelect.d.ts +2 -2
  3. package/dist/types/components/Sidebar/Sidebar.d.ts +39 -0
  4. package/dist/types/components/Sidebar/SidebarContext.d.ts +2 -0
  5. package/dist/types/components/Sidebar/SidebarGroup.d.ts +13 -0
  6. package/dist/types/components/Sidebar/SidebarMenu.d.ts +30 -0
  7. package/dist/types/components/Sidebar/constants.d.ts +48 -0
  8. package/dist/types/components/Sidebar/hooks/index.d.ts +1 -0
  9. package/dist/types/components/Sidebar/hooks/useSidebar/index.d.ts +1 -0
  10. package/dist/types/components/Sidebar/hooks/useSidebar/useSidebar.d.ts +1 -0
  11. package/dist/types/components/Sidebar/index.d.ts +4 -0
  12. package/dist/types/components/Sidebar/stories/examples/Sidebar.example.d.ts +57 -0
  13. package/dist/types/components/Sidebar/stories/examples/components/AppMain.d.ts +3 -0
  14. package/dist/types/components/Sidebar/stories/examples/components/AppSidebar.d.ts +6 -0
  15. package/dist/types/components/Sidebar/stories/examples/components/SearchForm.d.ts +1 -0
  16. package/dist/types/components/Sidebar/stories/examples/components/VersionSwitcher.d.ts +4 -0
  17. package/dist/types/components/Sidebar/types.d.ts +55 -0
  18. package/dist/types/hooks/index.d.ts +1 -0
  19. package/dist/types/hooks/useIsMobile/index.d.ts +1 -0
  20. package/dist/types/hooks/useIsMobile/useIsMobile.d.ts +1 -0
  21. package/dist/types/index.d.ts +2 -0
  22. package/package.json +3 -3
  23. package/src/components/Anchor/Anchor.tsx +2 -2
  24. package/src/components/Calendar/Calendar.tsx +1 -1
  25. package/src/components/Carousel/Carousel.tsx +1 -1
  26. package/src/components/Chart/stories/examples/LineChart.tsx +2 -2
  27. package/src/components/Combobox/Combobox.tsx +2 -2
  28. package/src/components/Command/Command.tsx +2 -2
  29. package/src/components/DatePicker/DatePicker.tsx +2 -2
  30. package/src/components/DatePicker/DateRangePicker.tsx +2 -2
  31. package/src/components/DatePicker/MultipleDatesPicker.tsx +2 -2
  32. package/src/components/Dialog/Dialog.tsx +2 -2
  33. package/src/components/FileUploader/FileUploader.tsx +2 -2
  34. package/src/components/Form/DatetimeInput/DatetimeCalendar.tsx +2 -2
  35. package/src/components/Form/MultiSelect/MultiSelect.tsx +2 -2
  36. package/src/components/Form/Select/Select.tsx +1 -1
  37. package/src/components/Form/TagsInput/TagsInput.tsx +2 -2
  38. package/src/components/Menu/ContextMenu/ContextMenu.tsx +2 -2
  39. package/src/components/Menu/DropdownMenu/DropdownMenu.tsx +2 -2
  40. package/src/components/Menu/Menubar/Menubar.tsx +2 -2
  41. package/src/components/Menu/NavigationMenu/NavigationMenu.tsx +1 -1
  42. package/src/components/Pagination/Pagination.tsx +2 -2
  43. package/src/components/Sidebar/Sidebar.tsx +326 -0
  44. package/src/components/Sidebar/SidebarContext.tsx +6 -0
  45. package/src/components/Sidebar/SidebarGroup.tsx +72 -0
  46. package/src/components/Sidebar/SidebarMenu.tsx +205 -0
  47. package/src/components/Sidebar/constants.ts +206 -0
  48. package/src/components/Sidebar/hooks/index.ts +1 -0
  49. package/src/components/Sidebar/hooks/useSidebar/index.ts +1 -0
  50. package/src/components/Sidebar/hooks/useSidebar/useSidebar.ts +11 -0
  51. package/src/components/Sidebar/index.ts +4 -0
  52. package/src/components/Sidebar/stories/examples/Sidebar.example.tsx +155 -0
  53. package/src/components/Sidebar/stories/examples/components/AppMain.tsx +36 -0
  54. package/src/components/Sidebar/stories/examples/components/AppSidebar.tsx +531 -0
  55. package/src/components/Sidebar/stories/examples/components/SearchForm.tsx +26 -0
  56. package/src/components/Sidebar/stories/examples/components/VersionSwitcher.tsx +45 -0
  57. package/src/components/Sidebar/types.ts +74 -0
  58. package/src/components/Widget/Widgets.example.tsx +2 -2
  59. package/src/hooks/index.ts +1 -0
  60. package/src/hooks/useIsMobile/index.ts +1 -0
  61. package/src/hooks/useIsMobile/useIsMobile.ts +19 -0
  62. 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
- }, "asChild" | "key" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "onChange" | "value"> & {
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
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
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
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
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
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "heading" | "value"> & {
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
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
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
- }, "asChild" | "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
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
- }, "asChild" | "key" | keyof import('react').HTMLAttributes<HTMLDivElement>> & {
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
- }, "asChild" | "key" | keyof import('react').HTMLAttributes<HTMLDivElement>>, "onSelect" | "disabled" | "value"> & {
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,2 @@
1
+ import { SidebarContextProps } from './types';
2
+ export declare const SidebarContext: import('react').Context<SidebarContextProps | null>;
@@ -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,4 @@
1
+ export { Sidebar } from './Sidebar';
2
+ export { SidebarGroup } from './SidebarGroup';
3
+ export { SidebarMenu } from './SidebarMenu';
4
+ export { useSidebar } from './hooks/useSidebar';
@@ -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,3 @@
1
+ import { HTMLAttributes } from 'react';
2
+ import { SidebarProps } from '../../../types';
3
+ export declare const AppMain: ({ side, ...props }: HTMLAttributes<HTMLDivElement> & Pick<SidebarProps, "side">) => 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,4 @@
1
+ export declare const VersionSwitcher: ({ versions, defaultVersion, }: {
2
+ versions: string[];
3
+ defaultVersion: string;
4
+ }) => 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;
@@ -42,3 +42,5 @@ export * from './components/HoverCard';
42
42
  export * from './components/Popover';
43
43
  export * from './components/Slot';
44
44
  export * from './components/Widget';
45
+ /** molecules */
46
+ export * from './components/Sidebar';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mbao01/common",
3
3
  "private": false,
4
- "version": "0.0.48",
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",
@@ -104,6 +103,7 @@
104
103
  "daisyui": "^4.12.13",
105
104
  "date-fns": "^4.1.0",
106
105
  "embla-carousel-react": "^8.3.0",
106
+ "lucide-react": "^0.453.0",
107
107
  "react-day-picker": "^9.2.0",
108
108
  "react-dropzone": "^14.2.10",
109
109
  "react-international-phone": "^4.3.0",
@@ -171,5 +171,5 @@
171
171
  "react-dom": "^18.2.0",
172
172
  "typescript": "^5.2.2"
173
173
  },
174
- "gitHead": "34986ed4f7018e59f157e933f118ba68be32fb98"
174
+ "gitHead": "86697af331eb24f58fb8689ebd8ca76d302ad387"
175
175
  }
@@ -1,4 +1,4 @@
1
- import { ExternalLinkIcon } from "@radix-ui/react-icons";
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 "@radix-ui/react-icons";
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 { DrawingPinIcon } from "@radix-ui/react-icons";
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
- <DrawingPinIcon
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 { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons";
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
- <CaretSortIcon className="ml-2 h-4 w-4 shrink-0 opacity-50" />
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
- <MagnifyingGlassIcon className="mr-2 h-4 w-4 shrink-0 opacity-50" />
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
- <CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
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
- <CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
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
- <CalendarIcon className="ml-auto h-4 w-4 opacity-50" />
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 { Cross2Icon } from "@radix-ui/react-icons";
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
- <Cross2Icon className="h-4 w-4" />
75
+ <XIcon className="h-4 w-4" />
76
76
  <span className="sr-only">Close</span>
77
77
  </DialogPrimitive.Close>
78
78
  ) : null}
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
4
4
  import { FileRejection, useDropzone } from "react-dropzone";
5
- import { TrashIcon } from "@radix-ui/react-icons";
5
+ import { DeleteIcon } from "lucide-react";
6
6
  import { toast } from "sonner";
7
7
  import type { DirectionOptions, FileUploaderInputProps, FileUploaderProps } from "./types";
8
8
  import { cn } from "../../utilities";
@@ -268,7 +268,7 @@ const FileUploaderItem = forwardRef<
268
268
  onClick={() => removeFileFromSet(index)}
269
269
  >
270
270
  <span className="sr-only">remove item {index}</span>
271
- <TrashIcon
271
+ <DeleteIcon
272
272
  className={cn("w-4 h-4 shrink-0 hover:stroke-destructive duration-200 ease-in-out", {
273
273
  "text-error": isSelected,
274
274
  })}
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from "react";
2
- import { CalendarIcon } from "@radix-ui/react-icons";
2
+ import { CalendarDaysIcon } from "lucide-react";
3
3
  import { cn } from "../../../utilities";
4
4
  import { Button } from "../../Button";
5
5
  import { Calendar } from "../../Calendar";
@@ -43,7 +43,7 @@ export const DatetimeCalendar = ({
43
43
  disabled={disabled}
44
44
  className={cn(getDatetimeCalendarTriggerClasses({ size }))}
45
45
  >
46
- <CalendarIcon className={getDatetimeCalendarIconClasses({ size })} />
46
+ <CalendarDaysIcon className={getDatetimeCalendarIconClasses({ size })} />
47
47
  <span className="sr-only">calendar</span>
48
48
  </Button>
49
49
  </Popover.Trigger>