@lateralus-ai/shipping-ui 2.0.0-dev.19 → 2.0.0-dev.3
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/components/Entry.d.ts +7 -27
- package/dist/components/Tabs.d.ts +5 -5
- package/dist/components/index.d.ts +2 -4
- package/dist/index.cjs +25 -25
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +4628 -4857
- package/dist/patterns/Search/ResultRow.d.ts +5 -11
- package/dist/patterns/Sidebar/sidebar-styles.d.ts +1 -2
- package/dist/primitives/Badge.d.ts +4 -7
- package/dist/primitives/index.d.ts +1 -1
- package/dist/tailwind-theme.d.ts +4 -8
- package/dist/{theme-entry-tLBc6zGT.mjs → theme-entry-CxDa1D0_.mjs} +8 -12
- package/dist/theme-entry-D2X3Ptjf.js +1 -0
- package/dist/theme.cjs +1 -1
- package/dist/theme.esm.js +1 -1
- package/package.json +2 -2
- package/src/components/Entry.tsx +45 -119
- package/src/components/Tabs.tsx +139 -146
- package/src/components/index.ts +42 -56
- package/src/index.ts +74 -85
- package/src/patterns/Search/ResultRow.tsx +58 -44
- package/src/patterns/Search/SearchModal.tsx +292 -310
- package/src/patterns/Search/index.ts +31 -31
- package/src/patterns/Sidebar/CollapsibleNavGroup.tsx +1 -1
- package/src/patterns/Sidebar/SidebarAction.tsx +17 -26
- package/src/patterns/Sidebar/SidebarEntry.tsx +39 -54
- package/src/patterns/Sidebar/SidebarLink.tsx +20 -30
- package/src/patterns/Sidebar/sidebar-styles.ts +1 -2
- package/src/patterns/Skeleton/Skeleton.tsx +56 -56
- package/src/primitives/Badge.tsx +10 -20
- package/src/primitives/Button.tsx +11 -16
- package/src/primitives/index.ts +1 -1
- package/src/stories/canvases/ContentCanvas.tsx +114 -353
- package/src/stories/canvases/SearchCanvas.tsx +150 -150
- package/src/tailwind-theme.ts +182 -186
- package/src/utils/cn.ts +1 -28
- package/dist/components/PageHeader.d.ts +0 -41
- package/dist/components/ScrollableList.d.ts +0 -22
- package/dist/theme-entry-Dwr2mV7_.js +0 -1
- package/src/components/PageHeader.tsx +0 -132
- package/src/components/ScrollableList.tsx +0 -61
package/src/components/Tabs.tsx
CHANGED
|
@@ -1,146 +1,139 @@
|
|
|
1
|
-
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
-
import {
|
|
3
|
-
createContext,
|
|
4
|
-
forwardRef,
|
|
5
|
-
useContext,
|
|
6
|
-
type ComponentPropsWithoutRef,
|
|
7
|
-
type ElementRef,
|
|
8
|
-
type ReactNode,
|
|
9
|
-
} from "react";
|
|
10
|
-
import { cn } from "../utils/cn";
|
|
11
|
-
|
|
12
|
-
export type TabsType = "tabs" | "pills";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
/** @deprecated Prefer Tabs + TabsTrigger. Kept for Storybook atom demos. */
|
|
142
|
-
export type TabsItem = {
|
|
143
|
-
label: string;
|
|
144
|
-
value?: string;
|
|
145
|
-
count?: number;
|
|
146
|
-
};
|
|
1
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
2
|
+
import {
|
|
3
|
+
createContext,
|
|
4
|
+
forwardRef,
|
|
5
|
+
useContext,
|
|
6
|
+
type ComponentPropsWithoutRef,
|
|
7
|
+
type ElementRef,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { cn } from "../utils/cn";
|
|
11
|
+
|
|
12
|
+
export type TabsType = "tabs" | "pills";
|
|
13
|
+
|
|
14
|
+
type TabsContextValue = {
|
|
15
|
+
type: TabsType;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const TabsContext = createContext<TabsContextValue>({ type: "tabs" });
|
|
19
|
+
|
|
20
|
+
export type TabsProps = ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {
|
|
21
|
+
type?: TabsType;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Tabs = ({
|
|
25
|
+
type = "tabs",
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}: TabsProps) => (
|
|
30
|
+
<TabsContext.Provider value={{ type }}>
|
|
31
|
+
<TabsPrimitive.Root
|
|
32
|
+
className={cn("flex flex-col", className)}
|
|
33
|
+
data-type={type}
|
|
34
|
+
{...props}
|
|
35
|
+
>
|
|
36
|
+
{children}
|
|
37
|
+
</TabsPrimitive.Root>
|
|
38
|
+
</TabsContext.Provider>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export type TabsListProps = ComponentPropsWithoutRef<typeof TabsPrimitive.List>;
|
|
42
|
+
|
|
43
|
+
export const TabsList = forwardRef<
|
|
44
|
+
ElementRef<typeof TabsPrimitive.List>,
|
|
45
|
+
TabsListProps
|
|
46
|
+
>(({ className, ...props }, ref) => {
|
|
47
|
+
const { type } = useContext(TabsContext);
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<TabsPrimitive.List
|
|
51
|
+
ref={ref}
|
|
52
|
+
className={cn(
|
|
53
|
+
"flex items-center",
|
|
54
|
+
type === "tabs" && "gap-1 border-b border-divider-primary",
|
|
55
|
+
type === "pills" && "gap-2",
|
|
56
|
+
className,
|
|
57
|
+
)}
|
|
58
|
+
{...props}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
});
|
|
62
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
63
|
+
|
|
64
|
+
export type TabsTriggerProps = ComponentPropsWithoutRef<
|
|
65
|
+
typeof TabsPrimitive.Trigger
|
|
66
|
+
> & {
|
|
67
|
+
/** Optional count badge (pill variant / search filters). */
|
|
68
|
+
count?: number;
|
|
69
|
+
children: ReactNode;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const TabsTrigger = forwardRef<
|
|
73
|
+
ElementRef<typeof TabsPrimitive.Trigger>,
|
|
74
|
+
TabsTriggerProps
|
|
75
|
+
>(({ className, count, children, ...props }, ref) => {
|
|
76
|
+
const { type } = useContext(TabsContext);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<TabsPrimitive.Trigger
|
|
80
|
+
ref={ref}
|
|
81
|
+
className={cn(
|
|
82
|
+
"inline-flex items-center justify-center transition-colors outline-none",
|
|
83
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
84
|
+
type === "tabs" && [
|
|
85
|
+
"relative px-3 py-2 text-caption-2 text-display-on-light-secondary",
|
|
86
|
+
"hover:text-display-on-light-primary",
|
|
87
|
+
"data-[state=active]:text-caption-2-em data-[state=active]:text-display-on-light-primary",
|
|
88
|
+
"data-[state=active]:after:absolute data-[state=active]:after:inset-x-0 data-[state=active]:after:-bottom-px",
|
|
89
|
+
"data-[state=active]:after:h-0.5 data-[state=active]:after:rounded-full data-[state=active]:after:bg-grey-900",
|
|
90
|
+
],
|
|
91
|
+
type === "pills" && [
|
|
92
|
+
"min-h-9 gap-2.5 rounded-full px-3 py-1 text-caption-2-em",
|
|
93
|
+
"bg-grey-100 text-display-on-light-secondary",
|
|
94
|
+
"hover:bg-grey-200",
|
|
95
|
+
"data-[state=active]:bg-accent-bg-light data-[state=active]:text-display-on-light-primary",
|
|
96
|
+
],
|
|
97
|
+
className,
|
|
98
|
+
)}
|
|
99
|
+
{...props}
|
|
100
|
+
>
|
|
101
|
+
{children}
|
|
102
|
+
{typeof count === "number" && (
|
|
103
|
+
<span
|
|
104
|
+
className={cn(
|
|
105
|
+
"inline-flex size-6 shrink-0 items-center justify-center rounded-full text-footnote-em",
|
|
106
|
+
"bg-accent-bg-light text-display-on-light-tertiary",
|
|
107
|
+
)}
|
|
108
|
+
aria-label={`Count: ${count}`}
|
|
109
|
+
>
|
|
110
|
+
{count > 99 ? "99+" : count}
|
|
111
|
+
</span>
|
|
112
|
+
)}
|
|
113
|
+
</TabsPrimitive.Trigger>
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
117
|
+
|
|
118
|
+
export type TabsContentProps = ComponentPropsWithoutRef<
|
|
119
|
+
typeof TabsPrimitive.Content
|
|
120
|
+
>;
|
|
121
|
+
|
|
122
|
+
export const TabsContent = forwardRef<
|
|
123
|
+
ElementRef<typeof TabsPrimitive.Content>,
|
|
124
|
+
TabsContentProps
|
|
125
|
+
>(({ className, ...props }, ref) => (
|
|
126
|
+
<TabsPrimitive.Content
|
|
127
|
+
ref={ref}
|
|
128
|
+
className={cn("outline-none", className)}
|
|
129
|
+
{...props}
|
|
130
|
+
/>
|
|
131
|
+
));
|
|
132
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
133
|
+
|
|
134
|
+
/** @deprecated Prefer Tabs + TabsTrigger. Kept for Storybook atom demos. */
|
|
135
|
+
export type TabsItem = {
|
|
136
|
+
label: string;
|
|
137
|
+
value?: string;
|
|
138
|
+
count?: number;
|
|
139
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -1,56 +1,42 @@
|
|
|
1
|
-
export { Input, type InputProps, type InputState } from "./Input";
|
|
2
|
-
export { ReportInput, type ReportInputProps, type ReportInputState } from "./ReportInput";
|
|
3
|
-
export { InputType, type InputTypeProps, type InputTypeKind, type InputTypeState } from "./InputType";
|
|
4
|
-
export { Chip, type ChipProps, type ChipVariant } from "./Chip";
|
|
5
|
-
export { Checkbox, type CheckboxProps } from "./Checkbox";
|
|
6
|
-
export { Tab, type TabProps, type TabState } from "./Tab";
|
|
7
|
-
export {
|
|
8
|
-
Tabs,
|
|
9
|
-
TabsList,
|
|
10
|
-
TabsTrigger,
|
|
11
|
-
TabsContent,
|
|
12
|
-
type TabsProps,
|
|
13
|
-
type TabsListProps,
|
|
14
|
-
type TabsTriggerProps,
|
|
15
|
-
type TabsContentProps,
|
|
16
|
-
type TabsItem,
|
|
17
|
-
type TabsType,
|
|
18
|
-
|
|
19
|
-
} from "./
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ModalTitle,
|
|
44
|
-
ModalDescription,
|
|
45
|
-
ModalHeaderSlot,
|
|
46
|
-
ModalBody,
|
|
47
|
-
type ModalProps,
|
|
48
|
-
type ModalOverlayProps,
|
|
49
|
-
type ModalContentProps,
|
|
50
|
-
type ModalTitleProps,
|
|
51
|
-
type ModalDescriptionProps,
|
|
52
|
-
type ModalBodyProps,
|
|
53
|
-
} from "./Modal";
|
|
54
|
-
export { ModalPanel } from "./ModalPanel";
|
|
55
|
-
export * from "./PdfViewer/";
|
|
56
|
-
export * from "./DocumentEditor";
|
|
1
|
+
export { Input, type InputProps, type InputState } from "./Input";
|
|
2
|
+
export { ReportInput, type ReportInputProps, type ReportInputState } from "./ReportInput";
|
|
3
|
+
export { InputType, type InputTypeProps, type InputTypeKind, type InputTypeState } from "./InputType";
|
|
4
|
+
export { Chip, type ChipProps, type ChipVariant } from "./Chip";
|
|
5
|
+
export { Checkbox, type CheckboxProps } from "./Checkbox";
|
|
6
|
+
export { Tab, type TabProps, type TabState } from "./Tab";
|
|
7
|
+
export {
|
|
8
|
+
Tabs,
|
|
9
|
+
TabsList,
|
|
10
|
+
TabsTrigger,
|
|
11
|
+
TabsContent,
|
|
12
|
+
type TabsProps,
|
|
13
|
+
type TabsListProps,
|
|
14
|
+
type TabsTriggerProps,
|
|
15
|
+
type TabsContentProps,
|
|
16
|
+
type TabsItem,
|
|
17
|
+
type TabsType,
|
|
18
|
+
} from "./Tabs";
|
|
19
|
+
export { Header, type HeaderProps, type HeaderVariant } from "./Header";
|
|
20
|
+
export { Entry, type EntryProps, type EntryType, type EntryState } from "./Entry";
|
|
21
|
+
export { EmptyState, type EmptyStateProps } from "./EmptyState";
|
|
22
|
+
export {
|
|
23
|
+
Modal,
|
|
24
|
+
ModalTrigger,
|
|
25
|
+
ModalClose,
|
|
26
|
+
ModalPortal,
|
|
27
|
+
ModalOverlay,
|
|
28
|
+
ModalContent,
|
|
29
|
+
ModalTitle,
|
|
30
|
+
ModalDescription,
|
|
31
|
+
ModalHeaderSlot,
|
|
32
|
+
ModalBody,
|
|
33
|
+
type ModalProps,
|
|
34
|
+
type ModalOverlayProps,
|
|
35
|
+
type ModalContentProps,
|
|
36
|
+
type ModalTitleProps,
|
|
37
|
+
type ModalDescriptionProps,
|
|
38
|
+
type ModalBodyProps,
|
|
39
|
+
} from "./Modal";
|
|
40
|
+
export { ModalPanel } from "./ModalPanel";
|
|
41
|
+
export * from "./PdfViewer/";
|
|
42
|
+
export * from "./DocumentEditor";
|
package/src/index.ts
CHANGED
|
@@ -1,85 +1,74 @@
|
|
|
1
|
-
import "./style.css";
|
|
2
|
-
|
|
3
|
-
export { theme as tailwindTheme } from "./tailwind-theme";
|
|
4
|
-
|
|
5
|
-
export * from "./tokens";
|
|
6
|
-
export * from "./icons";
|
|
7
|
-
export * from "./primitives";
|
|
8
|
-
export * from "./illustrations";
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
Input,
|
|
12
|
-
ReportInput,
|
|
13
|
-
InputType,
|
|
14
|
-
Chip,
|
|
15
|
-
Checkbox,
|
|
16
|
-
Tab,
|
|
17
|
-
Tabs,
|
|
18
|
-
TabsList,
|
|
19
|
-
TabsTrigger,
|
|
20
|
-
TabsContent,
|
|
21
|
-
Header,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
EmptyStateProps,
|
|
76
|
-
ModalProps,
|
|
77
|
-
ModalOverlayProps,
|
|
78
|
-
ModalContentProps,
|
|
79
|
-
ModalTitleProps,
|
|
80
|
-
ModalDescriptionProps,
|
|
81
|
-
ModalBodyProps,
|
|
82
|
-
} from "./components";
|
|
83
|
-
|
|
84
|
-
export * as Patterns from "./patterns";
|
|
85
|
-
export * as Domain from "./domain";
|
|
1
|
+
import "./style.css";
|
|
2
|
+
|
|
3
|
+
export { theme as tailwindTheme } from "./tailwind-theme";
|
|
4
|
+
|
|
5
|
+
export * from "./tokens";
|
|
6
|
+
export * from "./icons";
|
|
7
|
+
export * from "./primitives";
|
|
8
|
+
export * from "./illustrations";
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
Input,
|
|
12
|
+
ReportInput,
|
|
13
|
+
InputType,
|
|
14
|
+
Chip,
|
|
15
|
+
Checkbox,
|
|
16
|
+
Tab,
|
|
17
|
+
Tabs,
|
|
18
|
+
TabsList,
|
|
19
|
+
TabsTrigger,
|
|
20
|
+
TabsContent,
|
|
21
|
+
Header,
|
|
22
|
+
Entry,
|
|
23
|
+
EmptyState,
|
|
24
|
+
Modal,
|
|
25
|
+
ModalTrigger,
|
|
26
|
+
ModalClose,
|
|
27
|
+
ModalPortal,
|
|
28
|
+
ModalOverlay,
|
|
29
|
+
ModalContent,
|
|
30
|
+
ModalTitle,
|
|
31
|
+
ModalDescription,
|
|
32
|
+
ModalHeaderSlot,
|
|
33
|
+
ModalBody,
|
|
34
|
+
ModalPanel,
|
|
35
|
+
PdfViewer,
|
|
36
|
+
ImageViewer,
|
|
37
|
+
DocumentEditor,
|
|
38
|
+
} from "./components";
|
|
39
|
+
|
|
40
|
+
export type {
|
|
41
|
+
InputProps,
|
|
42
|
+
InputState,
|
|
43
|
+
ReportInputProps,
|
|
44
|
+
ReportInputState,
|
|
45
|
+
InputTypeProps,
|
|
46
|
+
InputTypeKind,
|
|
47
|
+
InputTypeState,
|
|
48
|
+
ChipProps,
|
|
49
|
+
ChipVariant,
|
|
50
|
+
CheckboxProps,
|
|
51
|
+
TabProps,
|
|
52
|
+
TabState,
|
|
53
|
+
TabsProps,
|
|
54
|
+
TabsListProps,
|
|
55
|
+
TabsTriggerProps,
|
|
56
|
+
TabsContentProps,
|
|
57
|
+
TabsItem,
|
|
58
|
+
TabsType,
|
|
59
|
+
HeaderProps,
|
|
60
|
+
HeaderVariant,
|
|
61
|
+
EntryProps,
|
|
62
|
+
EntryType,
|
|
63
|
+
EntryState,
|
|
64
|
+
EmptyStateProps,
|
|
65
|
+
ModalProps,
|
|
66
|
+
ModalOverlayProps,
|
|
67
|
+
ModalContentProps,
|
|
68
|
+
ModalTitleProps,
|
|
69
|
+
ModalDescriptionProps,
|
|
70
|
+
ModalBodyProps,
|
|
71
|
+
} from "./components";
|
|
72
|
+
|
|
73
|
+
export * as Patterns from "./patterns";
|
|
74
|
+
export * as Domain from "./domain";
|
|
@@ -1,44 +1,58 @@
|
|
|
1
|
-
import { type ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
className
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { ChatIcon, IssuesIcon, ReportIcon } from "../../icons";
|
|
3
|
+
import { cn } from "../../utils/cn";
|
|
4
|
+
|
|
5
|
+
export type ResultRowVariant = "report" | "chat" | "issue";
|
|
6
|
+
export type ResultRowState = "idle" | "active";
|
|
7
|
+
|
|
8
|
+
export type ResultRowProps = {
|
|
9
|
+
variant?: ResultRowVariant;
|
|
10
|
+
state?: ResultRowState;
|
|
11
|
+
title?: ReactNode;
|
|
12
|
+
/** Secondary line — excerpt, metadata, or highlighted query match. */
|
|
13
|
+
subtitle?: ReactNode;
|
|
14
|
+
onClick?: () => void;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const variantIcons: Record<ResultRowVariant, ReactNode> = {
|
|
19
|
+
report: <ReportIcon className="size-4" />,
|
|
20
|
+
chat: <ChatIcon className="size-4" />,
|
|
21
|
+
issue: <IssuesIcon className="size-4" />,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const ResultRow = ({
|
|
25
|
+
variant = "report",
|
|
26
|
+
state = "idle",
|
|
27
|
+
title = "Search result",
|
|
28
|
+
subtitle,
|
|
29
|
+
onClick,
|
|
30
|
+
className,
|
|
31
|
+
}: ResultRowProps) => (
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
className={cn(
|
|
35
|
+
"flex w-full items-center gap-4 rounded-control px-3 py-2.5 text-left transition-colors",
|
|
36
|
+
"hover:bg-[rgba(38,36,32,0.04)]",
|
|
37
|
+
state === "active" && "bg-[rgba(38,36,32,0.04)]",
|
|
38
|
+
className,
|
|
39
|
+
)}
|
|
40
|
+
data-variant={variant}
|
|
41
|
+
data-state={state}
|
|
42
|
+
onClick={onClick}
|
|
43
|
+
>
|
|
44
|
+
<span className="shrink-0 text-display-on-light-secondary">
|
|
45
|
+
{variantIcons[variant]}
|
|
46
|
+
</span>
|
|
47
|
+
<span className="min-w-0 flex-1">
|
|
48
|
+
<span className="block truncate text-caption-1-em text-display-on-light-primary">
|
|
49
|
+
{title}
|
|
50
|
+
</span>
|
|
51
|
+
{subtitle != null && subtitle !== false && (
|
|
52
|
+
<span className="mt-0.5 block truncate text-caption-2 text-display-on-light-secondary">
|
|
53
|
+
{subtitle}
|
|
54
|
+
</span>
|
|
55
|
+
)}
|
|
56
|
+
</span>
|
|
57
|
+
</button>
|
|
58
|
+
);
|