Skip to content

Commit

Permalink
refactor: adjust and rename hook exports
Browse files Browse the repository at this point in the history
  • Loading branch information
brunomous committed Aug 8, 2024
1 parent df4fcbc commit ce071f7
Show file tree
Hide file tree
Showing 14 changed files with 371 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"tsconfig-paths": "^3.10.1",
"typedoc": "^0.25.0",
"typedoc-plugin-coverage": "^3.2.0",
"typedoc-plugin-rename-defaults": "^0.7.1",
"typescript": "^4.3.5"
},
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion packages/react-auth-provider/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,10 @@ const AuthProvider = ({
);
};

export { LoginParams, useAuth, AuthProvider };
export {
LoginParams,
useAuth,
AuthProvider,
AuthProviderTypes,
AuthProviderProps,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { useAppBarRoot, AppBarContextProps } from './useAppBarRoot';

export { useAppBarRoot, AppBarContextProps };
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { createContext, useContext } from 'react';

type AppBarContextProps = {
export type AppBarContextProps = {
/**
* Boolean that indicates if the AppBar Drawer is open on a mobile screen.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useTableQueryState, getTableQueryState } from './useTableQueryState';
import { useTableRoot, TableContextProps } from './useTableRoot';

export {
useTableQueryState,
getTableQueryState,
useTableRoot,
TableContextProps,
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React, { createContext, useContext } from 'react';
import { HeaderProps, RowProps, TableQueryStateProps } from '../types';

type TableContextProps = {
export type TableContextProps = {
/**
* Array of objects, where each contain the data displayed in Table rows.
*/
Expand Down
15 changes: 15 additions & 0 deletions packages/react-material-ui/src/components/Table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ import { TableRowSkeleton } from './TableRowSkeleton';
import { TableCellSkeleton } from './TableCellSkeleton';
import { TableColumnOrderable } from './TableColumnOrderable';

import useTable, {
UseTableProps,
UseTableResult,
UseTableOptions,
UpdateSearch,
} from './useTable';

const TableComponent = {
Table,
BodyCell: TableBodyCells,
Expand All @@ -36,4 +43,12 @@ const TableComponent = {
ColumnOrderable: TableColumnOrderable,
};

export {
useTable,
UseTableProps,
UseTableResult,
UseTableOptions,
UpdateSearch,
};

export default TableComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { getSearchParams } from '../../utils/http';
import { DataProviderRequestOptions } from '@concepta/react-data-provider/dist/interfaces';

interface UseTableOptions {
export interface UseTableOptions {
/**
* Quantity of items displayed in a Table page.
*/
Expand Down
3 changes: 3 additions & 0 deletions packages/react-material-ui/src/hooks/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { useSettingsStorage } from './useSettingsStorage';

export { useSettingsStorage };
19 changes: 17 additions & 2 deletions packages/react-material-ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { AppBarRoot, AppBarRootProps } from './components/AppBar/AppBarRoot';
export { AppBarDrawer } from './components/AppBar/AppBarDrawer';
export { AppBarMain } from './components/AppBar/AppBarMain';
export { AppBarNav } from './components/AppBar/AppBarNav';
export * from './components/AppBar/hooks';

export { Dialog, DialogProps } from './components/Dialog';

Expand All @@ -32,9 +33,23 @@ export { SideModal, SideModalProps } from './components/SideModal';
export { default as Select } from './components/Select';
export { default as Switch } from './components/Switch';

import Table from './components/Table';
import Table, {
useTable,
UseTableOptions,
UseTableResult,
UseTableProps,
UpdateSearch,
} from './components/Table';
export * from './components/Table/utils';
export { Table };
export * from './components/Table/hooks';
export {
Table,
useTable,
UseTableOptions,
UseTableResult,
UseTableProps,
UpdateSearch,
};

export { default as Text } from './components/Text';
export { TextField, TextFieldProps } from './components/TextField';
Expand Down
9 changes: 9 additions & 0 deletions packages/react-material-ui/src/modules/crud/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import CrudRoot from './CrudRoot';
import { FilterDetails } from '../../components/submodules/Filter';
import Breadcrumbs from '../../components/Breadcrumbs/Breadcrumbs';

import {
useCrudRoot,
CrudContext,
CrudContextProps,
FilterValues,
} from './useCrudRoot';

type Action = 'creation' | 'edit' | 'details' | null;

type SelectedRow = Record<string, unknown> | null;
Expand Down Expand Up @@ -192,4 +199,6 @@ const CrudModule = (props: ModuleProps) => {
);
};

export { useCrudRoot, CrudContext, CrudContextProps, FilterValues };

export default CrudModule;
Loading

0 comments on commit ce071f7

Please sign in to comment.