@lateralus-ai/shipping-ui 1.1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/components/DocumentEditor/DocumentEditor.d.ts +4 -0
  2. package/dist/components/DocumentEditor/index.d.ts +1 -0
  3. package/dist/components/ModalPanel.d.ts +4 -0
  4. package/dist/components/PdfViewer/ImageViewer.d.ts +1 -1
  5. package/dist/components/PdfViewer/PdfViewer.d.ts +1 -1
  6. package/dist/components/PdfViewer/usePageManagement.d.ts +5 -1
  7. package/dist/components/SearchModal.d.ts +24 -0
  8. package/dist/components/Tabs.d.ts +13 -0
  9. package/dist/components/icons/SettingsIcon.d.ts +3 -0
  10. package/dist/components/index.d.ts +2 -0
  11. package/dist/defect-report.pdf +0 -0
  12. package/dist/example.pdf +0 -0
  13. package/dist/index.cjs +272 -10
  14. package/dist/index.esm.js +35960 -1124
  15. package/dist/material-theme.d.ts +26 -0
  16. package/dist/sample-document.docx +0 -0
  17. package/dist/stories/SearchModal.d.ts +1 -0
  18. package/dist/style.css +1 -0
  19. package/dist/tailwind-theme.d.ts +12 -0
  20. package/dist/types/documentEditor.d.ts +47 -0
  21. package/dist/utils/checkboxModule.d.ts +54 -0
  22. package/package.json +5 -1
  23. package/src/components/DocumentEditor/DocumentEditor.tsx +872 -0
  24. package/src/components/DocumentEditor/index.ts +1 -0
  25. package/src/components/ModalPanel.tsx +13 -0
  26. package/src/components/PdfViewer/ImageViewer.tsx +8 -3
  27. package/src/components/PdfViewer/PdfViewer.tsx +138 -17
  28. package/src/components/PdfViewer/usePageManagement.ts +22 -7
  29. package/src/components/SearchModal.tsx +320 -0
  30. package/src/components/Tabs.tsx +43 -0
  31. package/src/components/icons/SettingsIcon.tsx +33 -0
  32. package/src/components/index.ts +2 -0
  33. package/src/material-theme.ts +30 -0
  34. package/src/stories/DocumentEditor.stories.tsx +287 -0
  35. package/src/stories/ModalHeader.stories.tsx +36 -0
  36. package/src/stories/PDFViewer.stories.tsx +1 -1
  37. package/src/stories/SearchModal.stories.tsx +132 -0
  38. package/src/stories/SearchModal.tsx +82 -0
  39. package/src/stories/Tabs.stories.tsx +51 -0
  40. package/src/styles/tabs.css +55 -0
  41. package/src/tailwind-theme.ts +12 -0
  42. package/src/types/documentEditor.ts +56 -0
  43. package/src/utils/checkboxModule.ts +242 -0
@@ -0,0 +1 @@
1
+ export { default as DocumentEditor } from "./DocumentEditor";
@@ -31,6 +31,19 @@ const Header = ({
31
31
  );
32
32
  };
33
33
 
34
+ interface BodyProps {
35
+ className?: string;
36
+ }
37
+
38
+ const Body = ({ children, className = "" }: PropsWithChildren<BodyProps>) => {
39
+ return (
40
+ <div className={`w-full overflow-auto ${className}`}>
41
+ {children}
42
+ </div>
43
+ );
44
+ };
45
+
34
46
  export const ModalPanel = {
35
47
  Header,
48
+ Body,
36
49
  };
@@ -7,6 +7,7 @@ import { useZoom } from "./useZoom";
7
7
  import { useRotation } from "./useRotation";
8
8
  import { usePanning } from "./usePanning";
9
9
  import { usePageManagement } from "./usePageManagement";
10
+ import { cn } from "../../utils/cn";
10
11
 
11
12
  interface ImageViewerProps {
12
13
  onClose: () => void;
@@ -16,24 +17,28 @@ interface ImageViewerProps {
16
17
  }
17
18
 
18
19
  export const ImageViewer = ({
20
+ className,
19
21
  onClose,
20
22
  totalPages,
21
23
  getImageSrc,
24
+ documentUrl,
22
25
  title = "PDF Viewer",
23
26
  }: ImageViewerProps) => {
24
27
  const [zoom, zoomActions] = useZoom();
25
28
  const [rotation, rotationActions] = useRotation();
26
29
  const [{ pan, isDragging }, panActions] = usePanning();
27
- const [currentPage, pageActions] = usePageManagement(totalPages);
30
+ const [{ currentPage }, pageActions] = usePageManagement(totalPages);
28
31
 
29
32
  const rightButtons = (
30
33
  <IconButton variant="text" color="gray">
31
- <ExpandIcon className="size-4" />
34
+ <a href={documentUrl} target="_blank" rel="noopener noreferrer">
35
+ <ExpandIcon className="size-4" />
36
+ </a>
32
37
  </IconButton>
33
38
  );
34
39
 
35
40
  return (
36
- <div className="shadow rounded-t-lg">
41
+ <div className={cn("shadow rounded-t-lg flex flex-col h-full", className)}>
37
42
  <ModalPanel.Header onClose={onClose} right={rightButtons}>
38
43
  {title}
39
44
  </ModalPanel.Header>
@@ -1,11 +1,20 @@
1
- import { useRef } from "react";
2
- import { IconButton } from "@material-tailwind/react";
1
+ import { IconButton, ButtonGroup, Tooltip } from "@material-tailwind/react";
2
+ import { Document, Page, pdfjs } from "react-pdf";
3
3
  import { ModalPanel } from "../ModalPanel";
4
4
  import ExpandIcon from "../icons/ExpandIcon";
5
- import { useRefDimensions } from "./useRefDimensions";
5
+ import { Icon } from "@iconify/react";
6
6
  import { cn } from "../../utils/cn";
7
+ import "react-pdf/dist/Page/AnnotationLayer.css";
8
+ import "react-pdf/dist/Page/TextLayer.css";
9
+ import { useState, ChangeEvent, useMemo } from "react";
10
+ import { useZoom } from "./useZoom";
11
+ import { useRotation } from "./useRotation";
12
+ import { usePageManagement } from "./usePageManagement";
13
+ import { usePanning } from "./usePanning";
7
14
 
8
- interface PdfViewerProps {
15
+ pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
16
+
17
+ interface PdfViewerProps extends React.HTMLProps<HTMLDivElement> {
9
18
  onClose: () => void;
10
19
  src: string;
11
20
  title?: string;
@@ -17,8 +26,11 @@ export const PdfViewer = ({
17
26
  title = "PDF Viewer",
18
27
  className,
19
28
  }: PdfViewerProps) => {
20
- const containerRef = useRef(null);
21
- const dimensions = useRefDimensions(containerRef);
29
+ const [zoom, zoomActions] = useZoom();
30
+ const [rotation, rotationActions] = useRotation();
31
+ const [{ currentPage, totalPages }, pageActions] = usePageManagement();
32
+ const [{ pan, isDragging }, panActions] = usePanning();
33
+
22
34
 
23
35
  const rightButtons = (
24
36
  <IconButton variant="text" color="gray">
@@ -34,21 +46,130 @@ export const PdfViewer = ({
34
46
  {title}
35
47
  </ModalPanel.Header>
36
48
 
37
- <div className="flex-1 grid">
38
- <div className="grid relative">
49
+ <div className="grid grow h-full overflow-hidden">
50
+ <div
51
+ className={cn(
52
+ "col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",
53
+ isDragging ? "cursor-grabbing" : "cursor-grab"
54
+ )}
55
+ onMouseDown={panActions.handleMouseDown}
56
+ onMouseMove={panActions.handleMouseMove}
57
+ onMouseUp={panActions.handleMouseUp}
58
+ onMouseLeave={panActions.handleMouseUp}
59
+ style={{
60
+ userSelect: 'none',
61
+ }}
62
+ >
39
63
  <div
40
- ref={containerRef}
41
- className="overflow-hidden col-start-1 row-start-1 bg-gray-200 h-full relative"
64
+ style={{
65
+ transform: `translate(${pan.x}px, ${pan.y}px)`,
66
+ transition: isDragging ? 'none' : 'transform 0.1s',
67
+ pointerEvents: 'none',
68
+ }}
42
69
  >
43
- <embed
44
- src={`${src}#view=FitH&navpanes=0&scrollbar=0`}
45
- type="application/pdf"
46
- width="100%"
47
- height="100%"
48
- style={{ border: "none" }}
49
- />
70
+ <Document
71
+ file={src}
72
+ onLoadSuccess={({ numPages }) => {
73
+ pageActions.setTotalPages(numPages);
74
+ }}
75
+ scale={zoom / 100}
76
+ rotate={rotation}
77
+ >
78
+ <Page
79
+ pageNumber={currentPage}
80
+ renderTextLayer={true}
81
+ renderAnnotationLayer={true}
82
+ />
83
+ </Document>
50
84
  </div>
51
85
  </div>
86
+
87
+ <div className="col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10">
88
+ <ButtonGroup className="divide-x-0 h-[52px]">
89
+ <IconButton
90
+ variant="filled"
91
+ color="white"
92
+ className="py-[26px]"
93
+ onClick={zoomActions.zoomOut}
94
+ >
95
+ <Icon icon="lucide:minus" />
96
+ </IconButton>
97
+ <Tooltip content="Click to reset zoom and pan">
98
+ <button
99
+ className="!bg-white text-center cursor-pointer w-[60px]"
100
+ onClick={() => {
101
+ zoomActions.reset();
102
+ panActions.reset();
103
+ }}
104
+ >
105
+ {zoom}%
106
+ </button>
107
+ </Tooltip>
108
+ <IconButton
109
+ variant="filled"
110
+ color="white"
111
+ className="py-[26px]"
112
+ onClick={zoomActions.zoomIn}
113
+ >
114
+ <Icon icon="lucide:plus" />
115
+ </IconButton>
116
+ </ButtonGroup>
117
+ <ButtonGroup className="divide-x-0 h-[52px]">
118
+ <IconButton
119
+ variant="filled"
120
+ color="white"
121
+ className="py-[26px]"
122
+ onClick={rotationActions.rotateClockwise}
123
+ >
124
+ <Icon icon="lucide:iteration-cw" />
125
+ </IconButton>
126
+
127
+ <IconButton
128
+ variant="filled"
129
+ color="white"
130
+ className="py-[26px]"
131
+ onClick={rotationActions.rotateCounterClockwise}
132
+ >
133
+ <Icon icon="lucide:iteration-ccw" />
134
+ </IconButton>
135
+ </ButtonGroup>
136
+ <ButtonGroup className="divide-x-0 ">
137
+ <IconButton
138
+ variant="filled"
139
+ color="white"
140
+ className="py-[26px]"
141
+ onClick={pageActions.prevPage}
142
+ disabled={currentPage === 1}
143
+ >
144
+ <Icon icon="lucide:chevron-left" />
145
+ </IconButton>
146
+ <input
147
+ className="bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]"
148
+ value={currentPage}
149
+ onChange={(e: ChangeEvent<HTMLInputElement>) => {
150
+ const page = parseInt(e.target.value);
151
+ if (!isNaN(page)) {
152
+ pageActions.goToPage(page);
153
+ }
154
+ }}
155
+ type="number"
156
+ min="1"
157
+ max={totalPages}
158
+ />
159
+ <div className="flex items-center bg-white px-2">
160
+ of {totalPages}
161
+ </div>
162
+ <IconButton
163
+ variant="filled"
164
+ color="white"
165
+ className="py-[26px]"
166
+ onClick={pageActions.nextPage}
167
+ disabled={currentPage === totalPages}
168
+ >
169
+ <Icon icon="lucide:chevron-right" />
170
+ </IconButton>
171
+ </ButtonGroup>
172
+ </div>
52
173
  </div>
53
174
  </div>
54
175
  );
@@ -1,14 +1,29 @@
1
- import { useState } from "react";
1
+ import { useState, useCallback } from "react";
2
2
 
3
- export const usePageManagement = (totalPages: number = 1) => {
3
+ export const usePageManagement = (initialTotalPages: number = 0) => {
4
4
  const [currentPage, setCurrentPage] = useState<number>(1);
5
+ const [totalPages, setTotalPages] = useState<number>(initialTotalPages);
5
6
 
6
7
  const actions = {
7
- nextPage: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
8
- prevPage: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
9
- goToPage: (page: number) =>
10
- setCurrentPage(Math.max(1, Math.min(page, totalPages))),
8
+ nextPage: useCallback(() => {
9
+ setCurrentPage((prev) => {
10
+ return prev < totalPages ? prev + 1 : prev;
11
+ });
12
+ }, [totalPages]),
13
+ prevPage: useCallback(() => {
14
+ setCurrentPage((prev) => Math.max(prev - 1, 1));
15
+ }, []),
16
+ goToPage: useCallback(
17
+ (page: number) => {
18
+ setCurrentPage(() => Math.max(1, Math.min(page, totalPages)));
19
+ },
20
+ [totalPages],
21
+ ),
22
+ setTotalPages: useCallback((pages: number) => {
23
+ setTotalPages(pages);
24
+ setCurrentPage((prev) => Math.min(prev, pages));
25
+ }, []),
11
26
  };
12
27
 
13
- return [currentPage, actions] as const;
28
+ return [{ currentPage, totalPages }, actions] as const;
14
29
  };
@@ -0,0 +1,320 @@
1
+ import { Dialog, DialogBody } from "@material-tailwind/react";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { useHotkeys } from "react-hotkeys-hook";
4
+ import { useMediaQuery } from "@uidotdev/usehooks";
5
+ import { cn } from "../utils/cn";
6
+
7
+ export const formatDateReport = (date: string | Date) => {
8
+ const formattedDate = new Date(date);
9
+ return formattedDate.toLocaleDateString("en-US", {
10
+ month: "long",
11
+ day: "numeric",
12
+ year: "numeric",
13
+ });
14
+ };
15
+
16
+ const highlightText = (text: string, searchTerm: string) => {
17
+ if (!searchTerm) return text;
18
+
19
+ const regex = new RegExp(`(\\b${searchTerm}\\b)`, "gi");
20
+ const parts = text.split(regex);
21
+ const firstMatchIndex = parts.findIndex((part) => regex.test(part));
22
+
23
+ if (firstMatchIndex === -1) return text;
24
+
25
+ if (firstMatchIndex === 0) {
26
+ return parts.map((part, i) =>
27
+ regex.test(part) ? (
28
+ <span key={i} className="text-gray-900 font-medium">
29
+ {part}
30
+ </span>
31
+ ) : (
32
+ part
33
+ ),
34
+ );
35
+ }
36
+
37
+ const matchedPart = parts[firstMatchIndex];
38
+ const beforeMatch = parts.slice(0, firstMatchIndex).join("");
39
+ const afterMatch = parts.slice(firstMatchIndex + 1).join("");
40
+
41
+ return (
42
+ <>
43
+ <span key="match" className="text-gray-900 font-medium">
44
+ {beforeMatch && <>...</>}
45
+ {matchedPart}
46
+ </span>
47
+ {afterMatch && <span key="after"> {afterMatch}</span>}
48
+ </>
49
+ );
50
+ };
51
+
52
+ export interface SearchItem {
53
+ id: string;
54
+ title: string;
55
+ subtitle?: string;
56
+ icon?: React.ReactNode;
57
+ metadata?: Record<string, any>;
58
+ }
59
+
60
+ export interface SearchModalProps {
61
+ open: boolean;
62
+ onClose: () => void;
63
+ items?: SearchItem[];
64
+ loading?: boolean;
65
+ placeholder?: string;
66
+ onSearch?: (query: string) => void;
67
+ onSelect?: (item: SearchItem) => void;
68
+ filterOptions?: string[];
69
+ selectedFilter?: string;
70
+ onFilterChange?: (filter: string) => void;
71
+ recentlyViewedLabel?: string;
72
+ noResultsText?: string;
73
+ }
74
+
75
+ const SearchFilters = ({
76
+ filters,
77
+ selected,
78
+ onChange,
79
+ }: {
80
+ filters: string[];
81
+ selected: string;
82
+ onChange: (filter: string) => void;
83
+ }) => {
84
+ return (
85
+ <div className="flex gap-2 px-2">
86
+ {filters.map((filter) => (
87
+ <button
88
+ key={filter}
89
+ onClick={() => onChange(filter)}
90
+ className={cn(
91
+ "px-3 py-1 text-sm rounded-full transition-colors",
92
+ selected === filter
93
+ ? "bg-brand-600 text-white"
94
+ : "bg-gray-100 text-gray-600 hover:bg-gray-200",
95
+ )}
96
+ >
97
+ {filter}
98
+ </button>
99
+ ))}
100
+ </div>
101
+ );
102
+ };
103
+
104
+ const SearchSkeleton = () => {
105
+ return (
106
+ <div className="p-4 flex flex-col gap-[6px]">
107
+ {[...Array(8)].map((_, i) => (
108
+ <div key={i} className="flex items-center gap-3 animate-pulse py-2">
109
+ <div className="size-3 bg-gray-100 rounded-full" />
110
+ <div className={cn(i % 2 === 0 ? "w-[250px]" : "w-[320px]","h-3 bg-gray-100 rounded-full")} />
111
+ </div>
112
+ ))}
113
+ </div>
114
+ );
115
+ };
116
+
117
+ const SearchItemComponent = ({
118
+ item,
119
+ isActive,
120
+ onClick,
121
+ searchTerm,
122
+ }: {
123
+ item: SearchItem;
124
+ isActive: boolean;
125
+ onClick: () => void;
126
+ searchTerm: string;
127
+ }) => {
128
+ return (
129
+ <div
130
+ onClick={onClick}
131
+ className={cn(
132
+ "flex items-center gap-3 p-2 rounded-lg cursor-pointer transition-colors",
133
+ isActive ? "bg-gray-100" : "hover:bg-gray-50",
134
+ )}
135
+ >
136
+ {item.icon && <div className="shrink-0 text-gray-600">{item.icon}</div>}
137
+ <div className="flex-1 min-w-0">
138
+ <div className="text-sm font-medium text-gray-900 truncate">
139
+ {item.title}
140
+ </div>
141
+ {item.subtitle && (
142
+ <div className="text-sm text-gray-600 truncate">
143
+ {typeof item.subtitle === "string"
144
+ ? highlightText(item.subtitle, searchTerm)
145
+ : item.subtitle}
146
+ </div>
147
+ )}
148
+ </div>
149
+ </div>
150
+ );
151
+ };
152
+
153
+ const SearchModal = ({
154
+ open,
155
+ onClose,
156
+ items = [],
157
+ loading = false,
158
+ placeholder = "Search...",
159
+ onSearch,
160
+ onSelect,
161
+ filterOptions = [],
162
+ selectedFilter = "All",
163
+ onFilterChange,
164
+ recentlyViewedLabel = "Recently viewed",
165
+ noResultsText = "No results found.",
166
+ }: SearchModalProps) => {
167
+ const [searchValue, setSearchValue] = useState("");
168
+ const [activeIndex, setActiveIndex] = useState(-1);
169
+ const isMobile = useMediaQuery("only screen and (max-width: 768px)");
170
+ const itemRefs = useRef<HTMLDivElement[]>([]);
171
+
172
+ useEffect(() => {
173
+ itemRefs.current = itemRefs.current.slice(0, items.length);
174
+ }, [items]);
175
+
176
+ useEffect(() => {
177
+ if (activeIndex > items.length) {
178
+ setActiveIndex(-1);
179
+ }
180
+ }, [items, activeIndex]);
181
+
182
+ useEffect(() => {
183
+ const currentItem = itemRefs.current[activeIndex];
184
+ currentItem?.scrollIntoView({
185
+ behavior: "smooth",
186
+ block: "nearest",
187
+ });
188
+ }, [activeIndex]);
189
+
190
+ useHotkeys(
191
+ "ArrowUp",
192
+ () => {
193
+ if (items.length === 0) return;
194
+ setActiveIndex((prev) => (prev <= 0 ? items.length - 1 : prev - 1));
195
+ },
196
+ {
197
+ preventDefault: true,
198
+ enableOnFormTags: true,
199
+ enabled: open,
200
+ },
201
+ );
202
+
203
+ useHotkeys(
204
+ "ArrowDown",
205
+ () => {
206
+ if (items.length === 0) return;
207
+ setActiveIndex((prev) => (prev >= items.length - 1 ? 0 : prev + 1));
208
+ },
209
+ {
210
+ preventDefault: true,
211
+ enableOnFormTags: true,
212
+ enabled: open,
213
+ },
214
+ );
215
+
216
+ useHotkeys(
217
+ "Enter",
218
+ () => {
219
+ if (activeIndex >= 0 && activeIndex < items.length) {
220
+ handleItemSelect(items[activeIndex]);
221
+ }
222
+ },
223
+ {
224
+ enableOnFormTags: true,
225
+ preventDefault: true,
226
+ enabled: open,
227
+ },
228
+ );
229
+
230
+ const handleSearchChange = (value: string) => {
231
+ setSearchValue(value);
232
+ onSearch?.(value);
233
+ };
234
+
235
+ const handleItemSelect = (item: SearchItem) => {
236
+ onSelect?.(item);
237
+ handleClose();
238
+ };
239
+
240
+ const handleClose = () => {
241
+ setSearchValue("");
242
+ setActiveIndex(-1);
243
+ onClose();
244
+ };
245
+
246
+ const showFilters = filterOptions.length > 0 && searchValue;
247
+ const showRecentlyViewed = !searchValue && items.length > 0;
248
+
249
+ return (
250
+ <Dialog
251
+ open={open}
252
+ size="lg"
253
+ handler={handleClose}
254
+ className={cn(
255
+ isMobile && "w-screen m-0",
256
+ "focus:outline-none 2xl:min-w-px",
257
+ )}
258
+ >
259
+ <DialogBody className="relative px-0 py-2">
260
+ <div>
261
+ <div className="border-b border-b-gray-100 px-6 pb-2">
262
+ <input
263
+ type="text"
264
+ placeholder={placeholder}
265
+ value={searchValue}
266
+ onChange={(e) => handleSearchChange(e.target.value)}
267
+ className="w-full bg-transparent p-2 px-0 text-sm font-medium text-gray-600 placeholder-gray-400 outline-none focus:outline-none"
268
+ />
269
+ </div>
270
+
271
+ {loading ? (
272
+ <SearchSkeleton />
273
+ ) : (
274
+ <div className="p-4 flex flex-col gap-2">
275
+ {showRecentlyViewed && (
276
+ <p className="text-sm font-normal text-gray-600 px-2">
277
+ {recentlyViewedLabel}
278
+ </p>
279
+ )}
280
+
281
+ {showFilters && (
282
+ <SearchFilters
283
+ filters={filterOptions}
284
+ selected={selectedFilter}
285
+ onChange={(filter) => onFilterChange?.(filter)}
286
+ />
287
+ )}
288
+
289
+ <div className="overflow-y-auto max-h-[320px]" tabIndex={0}>
290
+ {items.map((item, index) => (
291
+ <div
292
+ key={item.id}
293
+ ref={(el) => {
294
+ if (el) itemRefs.current[index] = el;
295
+ }}
296
+ >
297
+ <SearchItemComponent
298
+ item={item}
299
+ isActive={activeIndex === index}
300
+ onClick={() => handleItemSelect(item)}
301
+ searchTerm={searchValue}
302
+ />
303
+ </div>
304
+ ))}
305
+
306
+ {!loading && items.length === 0 && (
307
+ <div className="text-sm text-gray-900 font-medium">
308
+ {noResultsText}
309
+ </div>
310
+ )}
311
+ </div>
312
+ </div>
313
+ )}
314
+ </div>
315
+ </DialogBody>
316
+ </Dialog>
317
+ );
318
+ };
319
+
320
+ export default SearchModal;
@@ -0,0 +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
+ };
@@ -0,0 +1,33 @@
1
+ export const SettingsIcon = ({ ...props }) => {
2
+ return (
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ width="16"
6
+ height="16"
7
+ viewBox="0 0 16 16"
8
+ fill="none"
9
+ {...props}
10
+ >
11
+ <path
12
+ fill-rule="evenodd"
13
+ clip-rule="evenodd"
14
+ d="M3.16699 7.7334C4.91574 7.73357 6.33301 9.1516 6.33301 10.9004C6.33283 12.3905 5.30337 13.6386 3.91699 13.9756V15.25C3.91685 15.664 3.58098 15.9998 3.16699 16C2.75287 16 2.41713 15.6641 2.41699 15.25V13.9756C1.0303 13.6387 0.000177983 12.3906 0 10.9004C0 9.15149 1.41809 7.7334 3.16699 7.7334ZM3.16699 9.2334C2.24652 9.2334 1.5 9.97992 1.5 10.9004C1.50021 11.8207 2.24665 12.5664 3.16699 12.5664C4.08719 12.5662 4.8328 11.8206 4.83301 10.9004C4.83301 9.98002 4.08732 9.23357 3.16699 9.2334Z"
15
+ fill="currentColor"
16
+ />
17
+ <path
18
+ d="M11.8662 9.66699C12.2804 9.66699 12.6162 10.0028 12.6162 10.417V15.25C12.616 15.6641 12.2803 16 11.8662 16C11.4523 15.9998 11.1164 15.6639 11.1162 15.25V10.417C11.1162 10.0029 11.4522 9.66722 11.8662 9.66699Z"
19
+ fill="currentColor"
20
+ />
21
+ <path
22
+ fill-rule="evenodd"
23
+ clip-rule="evenodd"
24
+ d="M11.8662 0C12.2804 0 12.6162 0.335786 12.6162 0.75V2.02344C14.0032 2.36025 15.0332 3.60999 15.0332 5.10059C15.0329 6.84904 13.6157 8.26633 11.8672 8.2666C10.1185 8.2666 8.70052 6.84921 8.7002 5.10059C8.7002 3.6104 9.7297 2.36066 11.1162 2.02344V0.75C11.1162 0.335929 11.4522 0.000230806 11.8662 0ZM11.8672 3.43359C10.9467 3.43359 10.2002 4.18011 10.2002 5.10059C10.2005 6.02078 10.9469 6.7666 11.8672 6.7666C12.7872 6.76633 13.5329 6.02062 13.5332 5.10059C13.5332 4.18028 12.7874 3.43387 11.8672 3.43359Z"
25
+ fill="currentColor"
26
+ />
27
+ <path
28
+ d="M3.16699 0C3.58107 0.000164881 3.91699 0.335888 3.91699 0.75V5.58301C3.91699 5.99712 3.58107 6.33284 3.16699 6.33301C2.75278 6.33301 2.41699 5.99722 2.41699 5.58301V0.75C2.41699 0.335786 2.75278 0 3.16699 0Z"
29
+ fill="currentColor"
30
+ />
31
+ </svg>
32
+ );
33
+ };
@@ -2,3 +2,5 @@ export * from "./HelloWorld";
2
2
  export * as InputPrompt from "./InputPrompt";
3
3
  export * as Sidebar from "./Sidebar";
4
4
  export * from "./PdfViewer/";
5
+ export * from "./Tabs";
6
+ export * from "./DocumentEditor";