@brainfish-ai/components 0.20.3 → 0.20.5

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/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
3
  import { ClassProp } from 'class-variance-authority/types';
4
4
  import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
5
5
  import { ColumnDef } from '@tanstack/react-table';
6
+ import { ComponentProps } from 'react';
6
7
  import { DayPicker } from 'react-day-picker';
7
8
  import { default as default_2 } from 'react';
8
9
  import * as DialogPrimitive from '@radix-ui/react-dialog';
@@ -35,18 +36,59 @@ export declare function AccordionItem({ className, ...props }: React_2.Component
35
36
 
36
37
  export declare function AccordionTrigger({ className, children, ...props }: React_2.ComponentProps<typeof AccordionPrimitive.Trigger>): React_2.JSX.Element;
37
38
 
38
- export declare type AccountDropdownItem = {
39
+ export declare type AccountDropdownActionItem = {
40
+ type?: 'action';
39
41
  id: string;
40
42
  label: string;
43
+ icon?: React_2.ReactNode;
41
44
  onClick: () => void;
42
45
  };
43
46
 
47
+ export declare type AccountDropdownItem = AccountDropdownActionItem | AccountDropdownSubmenuItem;
48
+
44
49
  declare interface AccountDropdownProps extends React_2.ComponentPropsWithoutRef<typeof DropdownMenu> {
45
50
  accountPhoto: string;
46
51
  accountName: string;
47
52
  accountDropdownItems: AccountDropdownItem[];
53
+ /** Side the dropdown opens on relative to the trigger. Defaults to 'bottom'. */
54
+ side?: React_2.ComponentPropsWithoutRef<typeof DropdownMenuContent>['side'];
55
+ /** Alignment of the dropdown relative to the trigger. Defaults to 'end'. */
56
+ align?: React_2.ComponentPropsWithoutRef<typeof DropdownMenuContent>['align'];
48
57
  }
49
58
 
59
+ /** Sub-option with a required `value`, used in radio-mode submenus. */
60
+ export declare type AccountDropdownRadioSubOption = Omit<AccountDropdownSubOption, 'value' | 'onClick'> & {
61
+ value: string;
62
+ };
63
+
64
+ declare type AccountDropdownSubmenuBase = {
65
+ type: 'submenu';
66
+ id: string;
67
+ label: string;
68
+ icon?: React_2.ReactNode;
69
+ };
70
+
71
+ export declare type AccountDropdownSubmenuItem = AccountDropdownSubmenuBase & ({
72
+ /** The currently selected value. When provided with onValueChange, renders items as a radio group with selection indicators. */
73
+ value: string;
74
+ onValueChange: (value: string) => void;
75
+ items: AccountDropdownRadioSubOption[];
76
+ } | {
77
+ value?: never;
78
+ onValueChange?: never;
79
+ items: AccountDropdownSubOption[];
80
+ });
81
+
82
+ export declare type AccountDropdownSubOption = {
83
+ id: string;
84
+ label: string;
85
+ icon?: React_2.ReactNode;
86
+ /** Required for radio mode. */
87
+ value?: string;
88
+ /** Used in plain (non-radio) mode. */
89
+ onClick?: () => void;
90
+ };
91
+
50
92
  declare type Action = {
51
93
  id: string;
52
94
  type: ActionType;
@@ -285,6 +327,14 @@ export declare const badgeVariants: (props?: ({
285
327
  variant?: "default" | "disabled" | "destructive" | "success" | "warning" | null | undefined;
286
328
  } & ClassProp) | undefined) => string;
287
329
 
330
+ declare function Body_2({ children }: {
331
+ children?: default_2.ReactNode;
332
+ }): default_2.JSX.Element;
333
+
334
+ declare namespace Body_2 {
335
+ var displayName: string;
336
+ }
337
+
288
338
  export declare const BrainfishColors: {
289
339
  primary: {
290
340
  100: string;
@@ -758,6 +808,17 @@ declare type CompleteAnswer = {
758
808
  };
759
809
  };
760
810
 
811
+ declare namespace Compounds {
812
+ export {
813
+ MainArea,
814
+ Body_2 as Body,
815
+ Header,
816
+ LeftSidebar,
817
+ Main,
818
+ RightSidebar
819
+ }
820
+ }
821
+
761
822
  export declare function DataTable<TData extends Record<string, any> & {
762
823
  id?: string | number;
763
824
  }, TValue>({ columns, data, getRowCanExpand, className, expandeRowClassName, isLoading, skeletonRowCount, ...props }: DataTableProps<TData, TValue>): default_2.JSX.Element;
@@ -1028,6 +1089,89 @@ export declare const formatFileSize: (bytes: number) => string;
1028
1089
 
1029
1090
  export declare const FormattedMessage: FC<Props>;
1030
1091
 
1092
+ export declare const FullLayout: default_2.NamedExoticComponent<FullLayoutRootProps> & {
1093
+ readonly type: typeof FullLayoutRoot;
1094
+ } & {
1095
+ MainArea: typeof Compounds.MainArea;
1096
+ Body: typeof Compounds.Body;
1097
+ Header: typeof Compounds.Header;
1098
+ LeftSidebar: typeof Compounds.LeftSidebar;
1099
+ Main: typeof Compounds.Main;
1100
+ RightSidebar: typeof Compounds.RightSidebar;
1101
+ };
1102
+
1103
+ export declare interface FullLayoutContextValue {
1104
+ isSideNavOpen: boolean;
1105
+ isRightSidebarOpen: boolean;
1106
+ toggleSidebar: () => void;
1107
+ openRightSidebar: () => void;
1108
+ closeRightSidebar: () => void;
1109
+ toggleRightSidebar: () => void;
1110
+ showSidenav: () => void;
1111
+ disableLeftSideNav: boolean;
1112
+ leftNavWidth: number;
1113
+ isMobile: boolean;
1114
+ sideNavRef: default_2.RefObject<HTMLDivElement | null>;
1115
+ rightSidebarRef: default_2.RefObject<HTMLElement | null>;
1116
+ sidebarToggleRef: default_2.RefObject<HTMLButtonElement | null>;
1117
+ handleResizeStart: (e: default_2.MouseEvent) => void;
1118
+ handleResizeKeyDown: (e: default_2.KeyboardEvent) => void;
1119
+ ariaValuenow: number;
1120
+ ariaValuemin: number;
1121
+ ariaValuemax: number;
1122
+ }
1123
+
1124
+ export declare const FullLayoutHeader: default_2.ForwardRefExoticComponent<FullLayoutHeaderProps & default_2.RefAttributes<HTMLElement>>;
1125
+
1126
+ export declare interface FullLayoutHeaderProps extends default_2.ComponentPropsWithoutRef<'header'> {
1127
+ onOpenLeft?: () => void;
1128
+ onOpenRight?: () => void;
1129
+ }
1130
+
1131
+ export declare const FullLayoutLeftSidebar: default_2.ForwardRefExoticComponent<FullLayoutLeftSidebarProps & default_2.RefAttributes<HTMLDivElement>>;
1132
+
1133
+ export declare interface FullLayoutLeftSidebarProps extends Omit<default_2.ComponentPropsWithoutRef<'div'>, 'children'> {
1134
+ open: boolean;
1135
+ widthPx: number;
1136
+ onResizeStart: (e: default_2.MouseEvent) => void;
1137
+ onResizeKeyDown: (e: default_2.KeyboardEvent) => void;
1138
+ ariaValuenow: number;
1139
+ ariaValuemin: number;
1140
+ ariaValuemax: number;
1141
+ sidebarProps: ComponentProps<typeof Sidebar>;
1142
+ }
1143
+
1144
+ /** Nav state derived from route (e.g. active ids). Provided by Platform; when null, layout uses props only. */
1145
+ export declare interface FullLayoutNavState {
1146
+ appNavActiveId?: string;
1147
+ sectionNavActiveId?: string;
1148
+ activeArticleId?: string;
1149
+ }
1150
+
1151
+ export declare const FullLayoutNavStateContext: default_2.Context<FullLayoutNavState | null>;
1152
+
1153
+ export declare function FullLayoutProvider({ value, children }: FullLayoutProviderProps): default_2.JSX.Element;
1154
+
1155
+ declare interface FullLayoutProviderProps {
1156
+ value: FullLayoutContextValue;
1157
+ children: default_2.ReactNode;
1158
+ }
1159
+
1160
+ export declare const FullLayoutRightSidebar: default_2.ForwardRefExoticComponent<FullLayoutRightSidebarProps & default_2.RefAttributes<HTMLElement>>;
1161
+
1162
+ export declare interface FullLayoutRightSidebarProps extends Omit<default_2.ComponentPropsWithoutRef<'aside'>, 'children'> {
1163
+ open: boolean;
1164
+ children: default_2.ReactNode;
1165
+ }
1166
+
1167
+ declare function FullLayoutRoot({ children, disableLeftSideNav, className }: FullLayoutRootProps): default_2.JSX.Element;
1168
+
1169
+ export declare interface FullLayoutRootProps {
1170
+ children?: default_2.ReactNode;
1171
+ disableLeftSideNav?: boolean;
1172
+ className?: string;
1173
+ }
1174
+
1031
1175
  declare type GetActionInputs = {
1032
1176
  type: typeof AnswersActions.GET_ACTION_INPUTS;
1033
1177
  payload: {
@@ -1046,6 +1190,12 @@ declare type GetActionInputs = {
1046
1190
  */
1047
1191
  export declare const getCachedFonts: () => FontOption[] | null;
1048
1192
 
1193
+ declare function Header(props: ComponentProps<typeof HeaderNav>): default_2.JSX.Element | null;
1194
+
1195
+ declare namespace Header {
1196
+ var displayName: string;
1197
+ }
1198
+
1049
1199
  export declare const HEADER_NAV_HEIGHT = 60;
1050
1200
 
1051
1201
  export declare const HeaderNav: React_2.ForwardRefExoticComponent<HeaderNavProps & React_2.RefAttributes<HTMLElement>>;
@@ -1155,6 +1305,12 @@ declare type JSONSchema<T> = JSONSchemaType<T>;
1155
1305
 
1156
1306
  export declare const Label: React_2.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React_2.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: ClassProp | undefined) => string> & React_2.RefAttributes<HTMLLabelElement>>;
1157
1307
 
1308
+ declare function LeftSidebar(props: ComponentProps<typeof Sidebar>): default_2.JSX.Element | null;
1309
+
1310
+ declare namespace LeftSidebar {
1311
+ var displayName: string;
1312
+ }
1313
+
1158
1314
  /**
1159
1315
  * Load a Google Font stylesheet dynamically
1160
1316
  */
@@ -1171,6 +1327,22 @@ export declare interface LogoProps extends React_2.SVGProps<SVGSVGElement> {
1171
1327
 
1172
1328
  export declare type LogoVariant = 'mark' | 'text' | 'full';
1173
1329
 
1330
+ declare function Main({ children }: {
1331
+ children?: default_2.ReactNode;
1332
+ }): default_2.JSX.Element;
1333
+
1334
+ declare namespace Main {
1335
+ var displayName: string;
1336
+ }
1337
+
1338
+ declare function MainArea({ children }: {
1339
+ children?: default_2.ReactNode;
1340
+ }): default_2.JSX.Element;
1341
+
1342
+ declare namespace MainArea {
1343
+ var displayName: string;
1344
+ }
1345
+
1174
1346
  declare type MarkAsUncertain = {
1175
1347
  type: typeof AnswersActions.MARK_AS_UNCERTAIN;
1176
1348
  payload: {
@@ -1282,6 +1454,14 @@ declare type RedirectRule = {
1282
1454
  destination: string;
1283
1455
  };
1284
1456
 
1457
+ declare function RightSidebar({ children }: {
1458
+ children?: default_2.ReactNode;
1459
+ }): default_2.JSX.Element | null;
1460
+
1461
+ declare namespace RightSidebar {
1462
+ var displayName: string;
1463
+ }
1464
+
1285
1465
  export declare const ScrollArea: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
1286
1466
 
1287
1467
  export declare const ScrollBar: React_2.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -1580,8 +1760,36 @@ export declare interface UseFontOptionsReturn {
1580
1760
  loadFont: typeof loadFont;
1581
1761
  }
1582
1762
 
1763
+ export declare function useFullLayoutContext(): FullLayoutContextValue | null;
1764
+
1583
1765
  export declare const useIsChatSearchDirty: () => boolean;
1584
1766
 
1767
+ /**
1768
+ * Convenience hook for programmatically controlling the right sidebar.
1769
+ *
1770
+ * Must be used inside a `<FullLayout>` tree.
1771
+ *
1772
+ * @example
1773
+ * ```tsx
1774
+ * function MyComponent() {
1775
+ * const rightSidebar = useRightSidebar();
1776
+ * return <button onClick={rightSidebar.open}>Open sidebar</button>;
1777
+ * }
1778
+ * ```
1779
+ */
1780
+ export declare function useRightSidebar(): UseRightSidebarReturn;
1781
+
1782
+ export declare interface UseRightSidebarReturn {
1783
+ /** Whether the right sidebar is currently open. */
1784
+ isOpen: boolean;
1785
+ /** Open the right sidebar (no-op if already open). */
1786
+ open: () => void;
1787
+ /** Close the right sidebar (no-op if already closed). */
1788
+ close: () => void;
1789
+ /** Toggle the right sidebar open/closed. */
1790
+ toggle: () => void;
1791
+ }
1792
+
1585
1793
  export declare function useSidebar(): SidebarContextValue;
1586
1794
 
1587
1795
  export declare const ZoomableImage: React_2.FC<ZoomableImageProps>;