@lateralus-ai/shipping-ui 1.4.13 → 1.4.14
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/README.md +108 -108
- package/dist/index.cjs +38 -38
- package/dist/index.esm.js +4495 -4489
- package/dist/tailwind-theme.d.ts +12 -0
- package/package.json +99 -99
- package/src/components/DocumentEditor/DocumentEditor.tsx +871 -871
- package/src/components/HelloWorld.tsx +3 -3
- package/src/components/InputPrompt.tsx +96 -96
- package/src/components/ModalPanel.tsx +49 -49
- package/src/components/PdfViewer/ImageViewer.tsx +211 -211
- package/src/components/PdfViewer/PdfViewer.tsx +232 -232
- package/src/components/PdfViewer/index.ts +2 -2
- package/src/components/PdfViewer/usePageManagement.ts +32 -32
- package/src/components/PdfViewer/usePanning.ts +42 -42
- package/src/components/PdfViewer/useRefDimensions.ts +16 -16
- package/src/components/PdfViewer/useRotation.ts +13 -13
- package/src/components/PdfViewer/useZoom.ts +26 -26
- package/src/components/SearchModal.tsx +320 -320
- package/src/components/Sidebar/Button.tsx +20 -20
- package/src/components/Sidebar/Container.tsx +31 -31
- package/src/components/Sidebar/Item.tsx +39 -39
- package/src/components/Sidebar/Layout.tsx +32 -32
- package/src/components/Sidebar/Provider.tsx +47 -47
- package/src/components/Sidebar/SecondaryItem.tsx +39 -39
- package/src/components/Sidebar/SideContainer.tsx +31 -31
- package/src/components/Sidebar/ToggleCollapseButton.tsx +24 -24
- package/src/components/Sidebar/index.ts +8 -8
- package/src/components/Tabs.tsx +43 -43
- package/src/components/icons/CloseSidebarIcon.tsx +19 -19
- package/src/components/icons/CloseSidebarMidIcon.tsx +19 -19
- package/src/components/icons/ExpandIcon.tsx +21 -21
- package/src/components/icons/SendArrowIcon.tsx +23 -23
- package/src/components/icons/SendArrowIconGreen.tsx +17 -17
- package/src/components/icons/SettingsIcon.tsx +33 -33
- package/src/components/icons/XIcon.tsx +21 -21
- package/src/components/index.ts +6 -6
- package/src/index.ts +4 -4
- package/src/material-theme.ts +477 -477
- package/src/stories/Buttons.stories.tsx +15 -15
- package/src/stories/Buttons.tsx +52 -52
- package/src/stories/Checkbox.stories.tsx +15 -15
- package/src/stories/Checkbox.tsx +56 -56
- package/src/stories/ColorPalette.stories.tsx +15 -15
- package/src/stories/ColorPalette.tsx +85 -72
- package/src/stories/DocumentEditor.stories.tsx +287 -287
- package/src/stories/Dropdowns.stories.tsx +15 -15
- package/src/stories/Dropdowns.tsx +52 -52
- package/src/stories/InputPrompt.stories.tsx +15 -15
- package/src/stories/InputPrompt.tsx +63 -63
- package/src/stories/ModalHeader.stories.tsx +35 -35
- package/src/stories/PDFViewer.stories.tsx +39 -39
- package/src/stories/SearchModal.stories.tsx +132 -132
- package/src/stories/SearchModal.tsx +82 -82
- package/src/stories/Sidebar.stories.tsx +15 -15
- package/src/stories/Sidebar.tsx +108 -108
- package/src/stories/Tabs.stories.tsx +51 -51
- package/src/stories/Typography.stories.tsx +15 -15
- package/src/stories/Typography.tsx +110 -110
- package/src/style.css +2 -2
- package/src/styles/tabs.css +55 -55
- package/src/tailwind-theme.ts +243 -231
- package/src/types/documentEditor.ts +55 -55
- package/src/utils/checkboxModule.ts +241 -241
- package/src/utils/cn.ts +11 -11
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react"
|
|
2
|
-
import { cn } from "../../utils/cn"
|
|
3
|
-
import { collapsedContext } from "./Provider"
|
|
4
|
-
|
|
5
|
-
export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const Container = ({
|
|
10
|
-
className,
|
|
11
|
-
children,
|
|
12
|
-
...props
|
|
13
|
-
}: ContainerProps) => {
|
|
14
|
-
const { isCollapsed, isHovered, setIsHovered } = useContext(collapsedContext)!
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div
|
|
18
|
-
className={cn(
|
|
19
|
-
className,
|
|
20
|
-
isCollapsed && "shadow-lg rounded-lg",
|
|
21
|
-
isCollapsed && !isHovered ? "w-auto" : "w-[280px]",
|
|
22
|
-
"bg-gray-50 p-2 flex flex-col justify-between items-center rounded-tr-lg rounded-br-lg"
|
|
23
|
-
)}
|
|
24
|
-
onMouseEnter={() => isCollapsed && setIsHovered(true)}
|
|
25
|
-
onMouseLeave={() => isCollapsed && setIsHovered(false)}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
1
|
+
import { useContext, type ReactNode } from "react"
|
|
2
|
+
import { cn } from "../../utils/cn"
|
|
3
|
+
import { collapsedContext } from "./Provider"
|
|
4
|
+
|
|
5
|
+
export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: ReactNode
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Container = ({
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}: ContainerProps) => {
|
|
14
|
+
const { isCollapsed, isHovered, setIsHovered } = useContext(collapsedContext)!
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div
|
|
18
|
+
className={cn(
|
|
19
|
+
className,
|
|
20
|
+
isCollapsed && "shadow-lg rounded-lg",
|
|
21
|
+
isCollapsed && !isHovered ? "w-auto" : "w-[280px]",
|
|
22
|
+
"bg-gray-50 p-2 flex flex-col justify-between items-center rounded-tr-lg rounded-br-lg"
|
|
23
|
+
)}
|
|
24
|
+
onMouseEnter={() => isCollapsed && setIsHovered(true)}
|
|
25
|
+
onMouseLeave={() => isCollapsed && setIsHovered(false)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../utils/cn";
|
|
3
|
-
import { collapsedContext } from "./Provider";
|
|
4
|
-
|
|
5
|
-
interface ItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
isActive?: boolean;
|
|
9
|
-
trailing?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Item = ({
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
icon,
|
|
16
|
-
isActive,
|
|
17
|
-
trailing,
|
|
18
|
-
...props
|
|
19
|
-
}: ItemProps) => {
|
|
20
|
-
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
className={cn(
|
|
25
|
-
isActive ? "!text-gray-900" : "!text-gray-600",
|
|
26
|
-
"flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",
|
|
27
|
-
className,
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
>
|
|
31
|
-
<div className="flex items-center gap-2">
|
|
32
|
-
{icon}
|
|
33
|
-
{(!isCollapsed || isHovered) && children}
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
{(!isCollapsed || isHovered) && trailing}
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
1
|
+
import { useContext, type ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
|
+
import { collapsedContext } from "./Provider";
|
|
4
|
+
|
|
5
|
+
interface ItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
trailing?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Item = ({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
icon,
|
|
16
|
+
isActive,
|
|
17
|
+
trailing,
|
|
18
|
+
...props
|
|
19
|
+
}: ItemProps) => {
|
|
20
|
+
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={cn(
|
|
25
|
+
isActive ? "!text-gray-900" : "!text-gray-600",
|
|
26
|
+
"flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg px-2 cursor-pointer group",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
<div className="flex items-center gap-2">
|
|
32
|
+
{icon}
|
|
33
|
+
{(!isCollapsed || isHovered) && children}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
{(!isCollapsed || isHovered) && trailing}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { Provider } from "./Provider"
|
|
2
|
-
import { Container, type ContainerProps } from "./Container"
|
|
3
|
-
import { ReactNode } from "react"
|
|
4
|
-
import { SideContainer } from "./SideContainer"
|
|
5
|
-
|
|
6
|
-
interface LayoutProps extends ContainerProps {
|
|
7
|
-
isCollapsed?: boolean
|
|
8
|
-
sideContainer?: ReactNode
|
|
9
|
-
sideClassName?: string
|
|
10
|
-
onSwitchLayout?: (isCollapsed: boolean) => void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const Layout = ({
|
|
14
|
-
className,
|
|
15
|
-
children,
|
|
16
|
-
isCollapsed,
|
|
17
|
-
sideContainer,
|
|
18
|
-
sideClassName,
|
|
19
|
-
onSwitchLayout,
|
|
20
|
-
...props
|
|
21
|
-
}: LayoutProps) => {
|
|
22
|
-
return (
|
|
23
|
-
<Provider isCollapsed={isCollapsed} onSwitchLayout={onSwitchLayout}>
|
|
24
|
-
{sideContainer && (
|
|
25
|
-
<SideContainer className={sideClassName}>{sideContainer}</SideContainer>
|
|
26
|
-
)}
|
|
27
|
-
<Container className={className} {...props}>
|
|
28
|
-
{children}
|
|
29
|
-
</Container>
|
|
30
|
-
</Provider>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
1
|
+
import { Provider } from "./Provider"
|
|
2
|
+
import { Container, type ContainerProps } from "./Container"
|
|
3
|
+
import { ReactNode } from "react"
|
|
4
|
+
import { SideContainer } from "./SideContainer"
|
|
5
|
+
|
|
6
|
+
interface LayoutProps extends ContainerProps {
|
|
7
|
+
isCollapsed?: boolean
|
|
8
|
+
sideContainer?: ReactNode
|
|
9
|
+
sideClassName?: string
|
|
10
|
+
onSwitchLayout?: (isCollapsed: boolean) => void
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const Layout = ({
|
|
14
|
+
className,
|
|
15
|
+
children,
|
|
16
|
+
isCollapsed,
|
|
17
|
+
sideContainer,
|
|
18
|
+
sideClassName,
|
|
19
|
+
onSwitchLayout,
|
|
20
|
+
...props
|
|
21
|
+
}: LayoutProps) => {
|
|
22
|
+
return (
|
|
23
|
+
<Provider isCollapsed={isCollapsed} onSwitchLayout={onSwitchLayout}>
|
|
24
|
+
{sideContainer && (
|
|
25
|
+
<SideContainer className={sideClassName}>{sideContainer}</SideContainer>
|
|
26
|
+
)}
|
|
27
|
+
<Container className={className} {...props}>
|
|
28
|
+
{children}
|
|
29
|
+
</Container>
|
|
30
|
+
</Provider>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { createContext, useState, type ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export const collapsedContext = createContext<
|
|
4
|
-
| {
|
|
5
|
-
isCollapsed: boolean;
|
|
6
|
-
toggleCollapsed: () => void;
|
|
7
|
-
isHovered: boolean;
|
|
8
|
-
setIsHovered: (value: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
| undefined
|
|
11
|
-
>(undefined);
|
|
12
|
-
|
|
13
|
-
interface ProviderProps {
|
|
14
|
-
children: ReactNode;
|
|
15
|
-
isCollapsed?: boolean;
|
|
16
|
-
onSwitchLayout?: (isCollapsed: boolean) => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const Provider = ({
|
|
20
|
-
children,
|
|
21
|
-
isCollapsed: controlledIsCollapsed,
|
|
22
|
-
onSwitchLayout,
|
|
23
|
-
}: ProviderProps) => {
|
|
24
|
-
const [internalIsCollapsed, setInternalIsCollapsed] = useState(false);
|
|
25
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
26
|
-
|
|
27
|
-
const isCollapsed =
|
|
28
|
-
controlledIsCollapsed !== undefined
|
|
29
|
-
? controlledIsCollapsed
|
|
30
|
-
: internalIsCollapsed;
|
|
31
|
-
|
|
32
|
-
const toggleCollapsed = (value?: boolean) => {
|
|
33
|
-
const newValue = value ?? !isCollapsed;
|
|
34
|
-
if (controlledIsCollapsed === undefined) {
|
|
35
|
-
setInternalIsCollapsed(newValue);
|
|
36
|
-
}
|
|
37
|
-
onSwitchLayout?.(newValue);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return (
|
|
41
|
-
<collapsedContext.Provider
|
|
42
|
-
value={{ isCollapsed, toggleCollapsed, isHovered, setIsHovered }}
|
|
43
|
-
>
|
|
44
|
-
{children}
|
|
45
|
-
</collapsedContext.Provider>
|
|
46
|
-
);
|
|
47
|
-
};
|
|
1
|
+
import { createContext, useState, type ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export const collapsedContext = createContext<
|
|
4
|
+
| {
|
|
5
|
+
isCollapsed: boolean;
|
|
6
|
+
toggleCollapsed: () => void;
|
|
7
|
+
isHovered: boolean;
|
|
8
|
+
setIsHovered: (value: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
| undefined
|
|
11
|
+
>(undefined);
|
|
12
|
+
|
|
13
|
+
interface ProviderProps {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
isCollapsed?: boolean;
|
|
16
|
+
onSwitchLayout?: (isCollapsed: boolean) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const Provider = ({
|
|
20
|
+
children,
|
|
21
|
+
isCollapsed: controlledIsCollapsed,
|
|
22
|
+
onSwitchLayout,
|
|
23
|
+
}: ProviderProps) => {
|
|
24
|
+
const [internalIsCollapsed, setInternalIsCollapsed] = useState(false);
|
|
25
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
26
|
+
|
|
27
|
+
const isCollapsed =
|
|
28
|
+
controlledIsCollapsed !== undefined
|
|
29
|
+
? controlledIsCollapsed
|
|
30
|
+
: internalIsCollapsed;
|
|
31
|
+
|
|
32
|
+
const toggleCollapsed = (value?: boolean) => {
|
|
33
|
+
const newValue = value ?? !isCollapsed;
|
|
34
|
+
if (controlledIsCollapsed === undefined) {
|
|
35
|
+
setInternalIsCollapsed(newValue);
|
|
36
|
+
}
|
|
37
|
+
onSwitchLayout?.(newValue);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<collapsedContext.Provider
|
|
42
|
+
value={{ isCollapsed, toggleCollapsed, isHovered, setIsHovered }}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</collapsedContext.Provider>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react";
|
|
2
|
-
import { cn } from "../../utils/cn";
|
|
3
|
-
import { collapsedContext } from "./Provider";
|
|
4
|
-
|
|
5
|
-
interface SecondaryItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
-
children?: ReactNode;
|
|
7
|
-
icon?: ReactNode;
|
|
8
|
-
isActive?: boolean;
|
|
9
|
-
trailing?: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const SecondaryItem = ({
|
|
13
|
-
children,
|
|
14
|
-
className,
|
|
15
|
-
isActive,
|
|
16
|
-
trailing,
|
|
17
|
-
icon,
|
|
18
|
-
...props
|
|
19
|
-
}: SecondaryItemProps) => {
|
|
20
|
-
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div
|
|
24
|
-
className={cn(
|
|
25
|
-
isActive ? "!text-gray-900" : "!text-gray-600",
|
|
26
|
-
"flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",
|
|
27
|
-
className,
|
|
28
|
-
)}
|
|
29
|
-
{...props}
|
|
30
|
-
>
|
|
31
|
-
<div className="flex items-center gap-2 overflow-auto">
|
|
32
|
-
{(!isCollapsed || isHovered) && icon}{" "}
|
|
33
|
-
{(!isCollapsed || isHovered) && children}
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
{(!isCollapsed || isHovered) && trailing}
|
|
37
|
-
</div>
|
|
38
|
-
);
|
|
39
|
-
};
|
|
1
|
+
import { useContext, type ReactNode } from "react";
|
|
2
|
+
import { cn } from "../../utils/cn";
|
|
3
|
+
import { collapsedContext } from "./Provider";
|
|
4
|
+
|
|
5
|
+
interface SecondaryItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
trailing?: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const SecondaryItem = ({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
isActive,
|
|
16
|
+
trailing,
|
|
17
|
+
icon,
|
|
18
|
+
...props
|
|
19
|
+
}: SecondaryItemProps) => {
|
|
20
|
+
const { isCollapsed, isHovered } = useContext(collapsedContext)!;
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div
|
|
24
|
+
className={cn(
|
|
25
|
+
isActive ? "!text-gray-900" : "!text-gray-600",
|
|
26
|
+
"flex items-center justify-between w-full hover:bg-gray-100 text-caption-1-em hover:text-gray-900 h-[38px] rounded-lg pr-2 pl-3 cursor-pointer group text-sm",
|
|
27
|
+
className,
|
|
28
|
+
)}
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
<div className="flex items-center gap-2 overflow-auto">
|
|
32
|
+
{(!isCollapsed || isHovered) && icon}{" "}
|
|
33
|
+
{(!isCollapsed || isHovered) && children}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
{(!isCollapsed || isHovered) && trailing}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { useContext, type ReactNode } from "react"
|
|
2
|
-
import { cn } from "../../utils/cn"
|
|
3
|
-
import { collapsedContext } from "./Provider"
|
|
4
|
-
|
|
5
|
-
export interface SideContainerProps
|
|
6
|
-
extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
children?: ReactNode
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const SideContainer = ({
|
|
11
|
-
className,
|
|
12
|
-
children,
|
|
13
|
-
...props
|
|
14
|
-
}: SideContainerProps) => {
|
|
15
|
-
const { isCollapsed, setIsHovered } = useContext(collapsedContext)!
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div
|
|
19
|
-
className={cn(
|
|
20
|
-
className,
|
|
21
|
-
isCollapsed && "!hidden",
|
|
22
|
-
"p-2 flex flex-col gap-2 items-center rounded-tl-lg rounded-bl-lg w-16"
|
|
23
|
-
)}
|
|
24
|
-
onMouseEnter={() => isCollapsed && setIsHovered(true)}
|
|
25
|
-
onMouseLeave={() => isCollapsed && setIsHovered(false)}
|
|
26
|
-
{...props}
|
|
27
|
-
>
|
|
28
|
-
{children}
|
|
29
|
-
</div>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
1
|
+
import { useContext, type ReactNode } from "react"
|
|
2
|
+
import { cn } from "../../utils/cn"
|
|
3
|
+
import { collapsedContext } from "./Provider"
|
|
4
|
+
|
|
5
|
+
export interface SideContainerProps
|
|
6
|
+
extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
children?: ReactNode
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const SideContainer = ({
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}: SideContainerProps) => {
|
|
15
|
+
const { isCollapsed, setIsHovered } = useContext(collapsedContext)!
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div
|
|
19
|
+
className={cn(
|
|
20
|
+
className,
|
|
21
|
+
isCollapsed && "!hidden",
|
|
22
|
+
"p-2 flex flex-col gap-2 items-center rounded-tl-lg rounded-bl-lg w-16"
|
|
23
|
+
)}
|
|
24
|
+
onMouseEnter={() => isCollapsed && setIsHovered(true)}
|
|
25
|
+
onMouseLeave={() => isCollapsed && setIsHovered(false)}
|
|
26
|
+
{...props}
|
|
27
|
+
>
|
|
28
|
+
{children}
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { useContext } from "react";
|
|
2
|
-
import { IconButton } from "@material-tailwind/react";
|
|
3
|
-
import { collapsedContext } from "./Provider";
|
|
4
|
-
import CloseSidebarIcon from "../icons/CloseSidebarIcon";
|
|
5
|
-
import CloseSidebarMidIcon from "../icons/CloseSidebarMidIcon";
|
|
6
|
-
|
|
7
|
-
export const ToggleCollapseButton = () => {
|
|
8
|
-
const { isCollapsed, isHovered, toggleCollapsed } =
|
|
9
|
-
useContext(collapsedContext)!;
|
|
10
|
-
|
|
11
|
-
if (isCollapsed && !isHovered) {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<IconButton variant="text" color="gray" onClick={() => toggleCollapsed()}>
|
|
17
|
-
{isCollapsed ? (
|
|
18
|
-
<CloseSidebarIcon className="size-4" />
|
|
19
|
-
) : (
|
|
20
|
-
<CloseSidebarMidIcon className="size-4" />
|
|
21
|
-
)}
|
|
22
|
-
</IconButton>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { IconButton } from "@material-tailwind/react";
|
|
3
|
+
import { collapsedContext } from "./Provider";
|
|
4
|
+
import CloseSidebarIcon from "../icons/CloseSidebarIcon";
|
|
5
|
+
import CloseSidebarMidIcon from "../icons/CloseSidebarMidIcon";
|
|
6
|
+
|
|
7
|
+
export const ToggleCollapseButton = () => {
|
|
8
|
+
const { isCollapsed, isHovered, toggleCollapsed } =
|
|
9
|
+
useContext(collapsedContext)!;
|
|
10
|
+
|
|
11
|
+
if (isCollapsed && !isHovered) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<IconButton variant="text" color="gray" onClick={() => toggleCollapsed()}>
|
|
17
|
+
{isCollapsed ? (
|
|
18
|
+
<CloseSidebarIcon className="size-4" />
|
|
19
|
+
) : (
|
|
20
|
+
<CloseSidebarMidIcon className="size-4" />
|
|
21
|
+
)}
|
|
22
|
+
</IconButton>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { Provider } from "./Provider"
|
|
2
|
-
export { Container } from "./Container"
|
|
3
|
-
export { SideContainer } from "./SideContainer"
|
|
4
|
-
export { Layout } from "./Layout"
|
|
5
|
-
export { Button } from "./Button"
|
|
6
|
-
export { ToggleCollapseButton } from "./ToggleCollapseButton"
|
|
7
|
-
export { Item } from "./Item"
|
|
8
|
-
export { SecondaryItem } from "./SecondaryItem"
|
|
1
|
+
export { Provider } from "./Provider"
|
|
2
|
+
export { Container } from "./Container"
|
|
3
|
+
export { SideContainer } from "./SideContainer"
|
|
4
|
+
export { Layout } from "./Layout"
|
|
5
|
+
export { Button } from "./Button"
|
|
6
|
+
export { ToggleCollapseButton } from "./ToggleCollapseButton"
|
|
7
|
+
export { Item } from "./Item"
|
|
8
|
+
export { SecondaryItem } from "./SecondaryItem"
|
package/src/components/Tabs.tsx
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import "../styles/tabs.css";
|
|
3
|
-
import {
|
|
4
|
-
Tabs,
|
|
5
|
-
TabPanel,
|
|
6
|
-
TabsBody,
|
|
7
|
-
TabsHeader,
|
|
8
|
-
Tab,
|
|
9
|
-
} from "@material-tailwind/react";
|
|
10
|
-
import { Icon } from "@iconify/react";
|
|
11
|
-
import { cn } from "../utils/cn";
|
|
12
|
-
import { SettingsIcon } from "./icons/SettingsIcon";
|
|
13
|
-
|
|
14
|
-
interface Tab {
|
|
15
|
-
id: string;
|
|
16
|
-
label: string;
|
|
17
|
-
content: React.ReactNode;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface TabsProps {
|
|
21
|
-
tabs: Tab[];
|
|
22
|
-
defaultTab?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const TabsContainer: React.FC<TabsProps> = () => {
|
|
26
|
-
return (
|
|
27
|
-
<Tabs className="w-[800px]">
|
|
28
|
-
<TabsHeader>
|
|
29
|
-
<Tab value="chats">Chats</Tab>
|
|
30
|
-
<Tab value="issues">Issues</Tab>
|
|
31
|
-
|
|
32
|
-
<button className="cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100">
|
|
33
|
-
<SettingsIcon className="size-4" />
|
|
34
|
-
</button>
|
|
35
|
-
</TabsHeader>
|
|
36
|
-
|
|
37
|
-
<TabsBody>
|
|
38
|
-
<TabPanel value="chats">ChatsPanel</TabPanel>
|
|
39
|
-
<TabPanel value="issues">IssuesPanel</TabPanel>
|
|
40
|
-
</TabsBody>
|
|
41
|
-
</Tabs>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import "../styles/tabs.css";
|
|
3
|
+
import {
|
|
4
|
+
Tabs,
|
|
5
|
+
TabPanel,
|
|
6
|
+
TabsBody,
|
|
7
|
+
TabsHeader,
|
|
8
|
+
Tab,
|
|
9
|
+
} from "@material-tailwind/react";
|
|
10
|
+
import { Icon } from "@iconify/react";
|
|
11
|
+
import { cn } from "../utils/cn";
|
|
12
|
+
import { SettingsIcon } from "./icons/SettingsIcon";
|
|
13
|
+
|
|
14
|
+
interface Tab {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
content: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface TabsProps {
|
|
21
|
+
tabs: Tab[];
|
|
22
|
+
defaultTab?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const TabsContainer: React.FC<TabsProps> = () => {
|
|
26
|
+
return (
|
|
27
|
+
<Tabs className="w-[800px]">
|
|
28
|
+
<TabsHeader>
|
|
29
|
+
<Tab value="chats">Chats</Tab>
|
|
30
|
+
<Tab value="issues">Issues</Tab>
|
|
31
|
+
|
|
32
|
+
<button className="cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100">
|
|
33
|
+
<SettingsIcon className="size-4" />
|
|
34
|
+
</button>
|
|
35
|
+
</TabsHeader>
|
|
36
|
+
|
|
37
|
+
<TabsBody>
|
|
38
|
+
<TabPanel value="chats">ChatsPanel</TabPanel>
|
|
39
|
+
<TabPanel value="issues">IssuesPanel</TabPanel>
|
|
40
|
+
</TabsBody>
|
|
41
|
+
</Tabs>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export default function CloseSidebarIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
4
|
-
return (
|
|
5
|
-
<svg
|
|
6
|
-
width="16"
|
|
7
|
-
height="16"
|
|
8
|
-
viewBox="0 0 16 16"
|
|
9
|
-
fill="none"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
{...props}
|
|
12
|
-
>
|
|
13
|
-
<path
|
|
14
|
-
d="M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z"
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
/>
|
|
17
|
-
</svg>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export default function CloseSidebarIcon(props: React.SVGProps<SVGSVGElement>) {
|
|
4
|
+
return (
|
|
5
|
+
<svg
|
|
6
|
+
width="16"
|
|
7
|
+
height="16"
|
|
8
|
+
viewBox="0 0 16 16"
|
|
9
|
+
fill="none"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
{...props}
|
|
12
|
+
>
|
|
13
|
+
<path
|
|
14
|
+
d="M13 1C14.6569 1 16 2.34315 16 4V12L15.9961 12.1543C15.9158 13.7394 14.6051 15 13 15H3L2.8457 14.9961C1.31166 14.9184 0.0816253 13.6883 0.00390625 12.1543L0 12V4C1.28853e-07 2.34315 1.34315 1 3 1H13ZM3 2.5C2.17157 2.5 1.5 3.17157 1.5 4V12C1.5 12.8284 2.17157 13.5 3 13.5H13C13.8284 13.5 14.5 12.8284 14.5 12V4C14.5 3.17157 13.8284 2.5 13 2.5H3ZM3.75 3.5C4.16421 3.5 4.5 3.83579 4.5 4.25V11.75C4.5 12.1642 4.16421 12.5 3.75 12.5C3.33579 12.5 3 12.1642 3 11.75V4.25C3 3.83579 3.33579 3.5 3.75 3.5Z"
|
|
15
|
+
fill="currentColor"
|
|
16
|
+
/>
|
|
17
|
+
</svg>
|
|
18
|
+
);
|
|
19
|
+
}
|