@yusr_systems/ui 3.0.0 → 3.1.1

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
@@ -13,6 +13,7 @@ import { ClassValue } from 'clsx';
13
13
  import { ColumnName } from '@yusr_systems/core';
14
14
  import { Combobox as Combobox_2 } from '@base-ui/react/combobox';
15
15
  import { Command as Command_2 } from 'cmdk';
16
+ import { Context } from 'react';
16
17
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
17
18
  import { DayButton } from 'react-day-picker';
18
19
  import { DayPicker } from 'react-day-picker';
@@ -28,6 +29,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
28
29
  import { FilterCondition } from '@yusr_systems/core';
29
30
  import { FilterResult } from '@yusr_systems/core';
30
31
  import { JSX } from 'react/jsx-runtime';
32
+ import { JSX as JSX_2 } from 'react';
31
33
  import * as LabelPrimitive from '@radix-ui/react-label';
32
34
  import { Locale } from 'react-day-picker';
33
35
  import { PayloadAction } from '@reduxjs/toolkit';
@@ -991,6 +993,8 @@ export declare function SideBarCompanyData({ company }: {
991
993
 
992
994
  export declare function SidebarContent({ className, ...props }: React_2.ComponentProps<"div">): JSX.Element;
993
995
 
996
+ export declare const SidebarContext: Context<YusrSidBarProps | null>;
997
+
994
998
  declare type SidebarContextProps = {
995
999
  state: "expanded" | "collapsed";
996
1000
  open: boolean;
@@ -1298,6 +1302,13 @@ declare interface UsernameObject {
1298
1302
 
1299
1303
  export declare function useSidebar(): SidebarContextProps;
1300
1304
 
1305
+ /**
1306
+ * Returns the props of the nearest SidebarProvider.
1307
+ * Must be used within a SidebarProvider.
1308
+ * @returns {YusrSidBarProps} The props of the nearest SidebarProvider.
1309
+ */
1310
+ export declare const useSidebarContext: () => YusrSidBarProps;
1311
+
1301
1312
  export declare function useStorageFile<T>(setFormData: React.Dispatch<React.SetStateAction<T>>, fieldName: keyof T): {
1302
1313
  fileInputRef: RefObject<HTMLInputElement | null>;
1303
1314
  handleFileChange: (event: React.ChangeEvent<HTMLInputElement>) => Promise<void>;
@@ -1311,6 +1322,60 @@ export declare const useTheme: () => ThemeProviderState;
1311
1322
 
1312
1323
  export declare function YusrBusBackground(): JSX.Element;
1313
1324
 
1325
+ export declare type YusrSidBarProps = {
1326
+ LinkComponent?: React.ElementType;
1327
+ logos: {
1328
+ logoFullDark: string;
1329
+ logoFullLight: string;
1330
+ logoOnlyDark: string;
1331
+ logoOnlyLight: string;
1332
+ };
1333
+ displayCompany?: {
1334
+ name: string;
1335
+ logo: string;
1336
+ };
1337
+ navMain?: {
1338
+ title: string;
1339
+ url: string;
1340
+ icon: JSX_2.Element;
1341
+ hasAuth: boolean;
1342
+ }[];
1343
+ navSecondary?: {
1344
+ title: string;
1345
+ url: string;
1346
+ icon: JSX_2.Element;
1347
+ }[];
1348
+ };
1349
+
1350
+ /**
1351
+ * A sidebar component for Yusuf UI.
1352
+ *
1353
+ * It provides a sidebar that can be collapsed and opened with a button.
1354
+ * The sidebar can be placed on the left or right side of the page.
1355
+ * It also provides a context for the sidebar items to access the sidebar state.
1356
+ *
1357
+ * @param {React.ComponentProps<typeof Sidebar>} props The props for the sidebar.
1358
+ * @param {YusrSidBarProps} props The props for the sidebar items.
1359
+ * @param {PropsWithChildren} props The props with children for the sidebar.
1360
+ * @param {React.ReactNode} [LinkComponent="a"] The component to use for the links in the sidebar.
1361
+ * @param {React.ReactNode} [logos] The logos to display in the sidebar.
1362
+ * @param {boolean} [displayCompany] Whether to display the company information in the sidebar.
1363
+ * @param {YusrSidBarMainMenuProps["items"]} [navMain] The main navigation items for the sidebar.
1364
+ * @param {YusrSidBarMainMenuProps["items"]} [navSecondary] The secondary navigation items for the sidebar.
1365
+ * @param {React.ReactNode} [children] The children of the sidebar component.
1366
+ */
1367
+ export declare function YusrSideBar({ LinkComponent, logos, displayCompany, navMain, navSecondary, children, ...props }: React.ComponentProps<typeof Sidebar> & YusrSidBarProps & PropsWithChildren): JSX.Element;
1368
+
1369
+ export declare namespace YusrSideBar {
1370
+ var Header: () => JSX.Element;
1371
+ var Content: ({ LogoutHandler, }: {
1372
+ LogoutHandler?: () => Promise<void>;
1373
+ }) => JSX.Element;
1374
+ var Footer: ({ loggedInUser }: {
1375
+ loggedInUser: any;
1376
+ }) => JSX.Element;
1377
+ }
1378
+
1314
1379
  export declare function YusrSideBarMainMenu({ items, LinkComponent, }: {
1315
1380
  items: {
1316
1381
  title: string;