@unifiedsoftware/react-ui 1.0.0 → 1.0.2

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.
@@ -0,0 +1,255 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, FC, Dispatch, SetStateAction } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import * as styled_components from 'styled-components';
5
+ import * as react_router_dom from 'react-router-dom';
6
+
7
+ type ButtonVariant = 'contained' | 'outlined' | 'text';
8
+ type ButtonColor = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
9
+ type ButtonSize = 'sm' | 'md' | 'lg';
10
+
11
+ interface Props$8 {
12
+ as?: React.ElementType;
13
+ variant?: ButtonVariant;
14
+ color?: ButtonColor;
15
+ size?: ButtonSize;
16
+ }
17
+ type NativeAttrs$2 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$8>;
18
+ type ButtonProps = Props$8 & NativeAttrs$2;
19
+ declare const Button: react.ForwardRefExoticComponent<Props$8 & NativeAttrs$2 & react.RefAttributes<HTMLButtonElement>>;
20
+
21
+ interface Props$7 {
22
+ as?: React.ElementType;
23
+ value: any;
24
+ }
25
+ type NativeAttrs$1 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$7>;
26
+ type TabProps = Props$7 & NativeAttrs$1;
27
+ declare const Tab: react.ForwardRefExoticComponent<Props$7 & NativeAttrs$1 & {
28
+ children?: react.ReactNode;
29
+ } & react.RefAttributes<HTMLDivElement>>;
30
+
31
+ interface Props$6 {
32
+ value?: any;
33
+ defaultValue?: any;
34
+ onChange?(value: any): void;
35
+ }
36
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$6>;
37
+ type TabsProps = Props$6 & NativeAttrs;
38
+ declare const Tabs: React.FC<TabsProps>;
39
+
40
+ interface IDropEnumList {
41
+ dataEnum: object;
42
+ description: Map<any, Map<number, string>>;
43
+ width: number;
44
+ defaultValue: number;
45
+ onChange: (number: any) => void;
46
+ }
47
+ declare const DropEnumList: React.FC<IDropEnumList>;
48
+
49
+ interface IBreadCrumbContext {
50
+ active: string;
51
+ setActive: (value: string) => void;
52
+ path: string;
53
+ setPath: (value: string) => void;
54
+ routes: {
55
+ route: string | -1;
56
+ title: string;
57
+ }[];
58
+ setRoutes: (value: {
59
+ route: string | -1;
60
+ title: string;
61
+ }[]) => void;
62
+ pathChild: string;
63
+ setPathChild: (value: string) => void;
64
+ goBack: boolean;
65
+ setGoBack: (value: boolean) => void;
66
+ }
67
+ declare const BreadCrumbContext: react.Context<IBreadCrumbContext>;
68
+ interface Props$5 {
69
+ children: ReactNode;
70
+ }
71
+ declare const BreadCrumbContextProvider: ({ children }: Props$5) => react_jsx_runtime.JSX.Element;
72
+
73
+ interface IDrawerContext {
74
+ active: boolean;
75
+ setActive: (value: boolean) => void;
76
+ }
77
+ declare const DrawerContext: react.Context<IDrawerContext>;
78
+ interface Props$4 {
79
+ children: ReactNode;
80
+ }
81
+ declare const DrawerContextProvider: FC<Props$4>;
82
+
83
+ interface GlobalProps {
84
+ children: ReactNode;
85
+ }
86
+ declare function GlobalProvider({ children }: GlobalProps): react_jsx_runtime.JSX.Element;
87
+
88
+ interface HistoryPath {
89
+ path: string;
90
+ name: string;
91
+ date?: Date;
92
+ }
93
+ interface IHistoryContext {
94
+ list: HistoryPath[];
95
+ updateList: (list: HistoryPath) => void;
96
+ }
97
+ declare const HistoryContext: react.Context<IHistoryContext>;
98
+ interface Props$3 {
99
+ children: React.ReactNode;
100
+ }
101
+ declare const HistoryContextProvider: ({ children }: Props$3) => react_jsx_runtime.JSX.Element;
102
+
103
+ interface ISidebarMainContext {
104
+ open: boolean;
105
+ setOpen: (value: boolean) => void;
106
+ }
107
+ declare const SidebarMainContext: react.Context<ISidebarMainContext>;
108
+ interface Props$2 {
109
+ children: ReactNode;
110
+ }
111
+ declare const SidebarMainContextProvider: ({ children }: Props$2) => react_jsx_runtime.JSX.Element;
112
+
113
+ declare global {
114
+ interface WindowEventMap {
115
+ 'local-storage': CustomEvent;
116
+ }
117
+ }
118
+ type SetValue<T> = Dispatch<SetStateAction<T>>;
119
+ /**
120
+ * It's a React hook that allows you to store and retrieve data from localStorage
121
+ * @param {string} key - string
122
+ * @param {T} initialValue - The initial value to use if the key doesn't exist in localStorage.
123
+ * @returns An array of two items. The first item is the value of the local storage key. The second
124
+ * item is a function that can be used to set the value of the local storage key.
125
+ */
126
+ declare function useLocalStorage<T>(key: string, initialValue: T): [T, SetValue<T>];
127
+
128
+ /**
129
+ * It returns the previous value of the given value
130
+ * @param {any} value - any - The value to track.
131
+ * @returns The previous value of the variable.
132
+ */
133
+ declare const usePrevious: (value: any) => undefined;
134
+
135
+ interface Helpers {
136
+ goToNextStep: () => void;
137
+ goToPrevStep: () => void;
138
+ reset: () => void;
139
+ canGoToNextStep: boolean;
140
+ canGoToPrevStep: boolean;
141
+ setStep: Dispatch<SetStateAction<number>>;
142
+ }
143
+ /**
144
+ * It returns a tuple with the current step and an object with functions to manipulate the step
145
+ * @param {number} maxStep - number - The maximum number of steps in the stepper.
146
+ * @returns An array with two elements. The first element is the current step. The second element is an
147
+ * object with the following properties:
148
+ */
149
+ declare const useStep: (maxStep: number) => [number, Helpers];
150
+
151
+ interface Props$1 {
152
+ title?: string;
153
+ paths?: {
154
+ route: string | -1;
155
+ title: string;
156
+ }[];
157
+ }
158
+ declare const AppBreadCrumb: ({ title, paths }: Props$1) => react_jsx_runtime.JSX.Element;
159
+ declare const AppBreadCrumbNav: ({ paths }: {
160
+ paths?: {
161
+ route: string;
162
+ title: string;
163
+ }[] | undefined;
164
+ }) => react_jsx_runtime.JSX.Element;
165
+
166
+ type LoadingType = 'window' | 'page' | 'grid' | 'button' | 'card' | 'div' | 'none';
167
+ /**
168
+ * If the gridContent exists, render the loader in the gridContent, otherwise, if the reportContent
169
+ * exists, render the loader in the reportContent, otherwise, render the loader in the current
170
+ * component.
171
+ * @returns A React component that is a portal.
172
+ */
173
+ declare const LoaderGrid: () => react_jsx_runtime.JSX.Element;
174
+ interface ILoaderProps {
175
+ type?: LoadingType;
176
+ parent?: string;
177
+ minDuration?: number;
178
+ }
179
+ /**
180
+ * It's a React component that renders a loading indicator in a parent element.
181
+ * @param props - {type?: LoadingType; parent?: string; minDuration?: number;}
182
+ * @returns A React component that is a function.
183
+ */
184
+ declare const AppLoader: FC<ILoaderProps>;
185
+
186
+ interface CustomBtns {
187
+ title?: string;
188
+ render?: React.ReactNode;
189
+ Icon?: ({ className }: {
190
+ className: string;
191
+ }) => JSX.Element;
192
+ onAction?: () => void;
193
+ }
194
+ interface CustomExcel {
195
+ title: string;
196
+ classNameIcon: string;
197
+ onAction: () => void;
198
+ }
199
+ interface ICustomizeColumns {
200
+ disabled?: boolean;
201
+ className?: string;
202
+ entityType: number;
203
+ data: any[];
204
+ onFetched: (columns: any[]) => void;
205
+ }
206
+ interface NavOptionsProps {
207
+ exportExcel?: CustomExcel[];
208
+ customButtons?: CustomBtns[];
209
+ onCreate?: () => void;
210
+ onRefresh?: () => void;
211
+ onSelect?: () => void;
212
+ onClear?: () => void;
213
+ onExpandScreen?: () => void;
214
+ }
215
+ declare const NavOptions: FC<NavOptionsProps>;
216
+
217
+ interface Props {
218
+ title?: string;
219
+ }
220
+ declare const Title: ({ title }: Props) => react_jsx_runtime.JSX.Element;
221
+
222
+ declare const Breadcrumb: styled_components.StyledComponent<"div", any, {}, never>;
223
+ declare const BreadCrumbTitle: styled_components.StyledComponent<"div", any, {}, never>;
224
+
225
+ interface MenuItemProps {
226
+ type?: 'row' | 'col';
227
+ width?: string;
228
+ }
229
+ declare const MenuItem: styled_components.StyledComponent<react.ForwardRefExoticComponent<react_router_dom.LinkProps & react.RefAttributes<HTMLAnchorElement>>, any, MenuItemProps, never>;
230
+ declare const MenuTitle: styled_components.StyledComponent<"p", any, {}, never>;
231
+
232
+ interface NavbarProps {
233
+ gradient?: boolean;
234
+ }
235
+ declare const Navbar: styled_components.StyledComponent<"nav", any, NavbarProps, never>;
236
+
237
+ declare const MenuOptions: styled_components.StyledComponent<"div", any, {}, never>;
238
+
239
+ interface SidebarProps {
240
+ width?: string;
241
+ active?: boolean;
242
+ fixed?: boolean;
243
+ shadow?: boolean;
244
+ }
245
+ declare const ItemSidebar: styled_components.StyledComponent<"div", any, {}, never>;
246
+ declare const SidebarNavigation: styled_components.StyledComponent<"nav", any, SidebarProps, never>;
247
+ declare const ItemLinkSidebar: styled_components.StyledComponent<react.ForwardRefExoticComponent<react_router_dom.LinkProps & react.RefAttributes<HTMLAnchorElement>>, any, {}, never>;
248
+
249
+ interface MainProps {
250
+ activeDrawer: boolean;
251
+ }
252
+ declare const Main: styled_components.StyledComponent<"main", any, MainProps, never>;
253
+ declare const CloseIcon: styled_components.StyledComponent<"button", any, {}, never>;
254
+
255
+ export { AppBreadCrumb, AppBreadCrumbNav, AppLoader, BreadCrumbContext, BreadCrumbContextProvider, BreadCrumbTitle, Breadcrumb, Button, ButtonColor, ButtonProps, ButtonSize, ButtonVariant, CloseIcon, CustomBtns, CustomExcel, DrawerContext, DrawerContextProvider, DropEnumList, GlobalProps, GlobalProvider, HistoryContext, HistoryContextProvider, IBreadCrumbContext, ICustomizeColumns, ILoaderProps, ItemLinkSidebar, ItemSidebar, LoaderGrid, LoadingType, Main, MenuItem, MenuOptions, MenuTitle, NavOptions, NavOptionsProps, Navbar, SidebarMainContext, SidebarMainContextProvider, SidebarNavigation, Tab, TabProps, Tabs, TabsProps, Title, useLocalStorage, usePrevious, useStep };
package/dist/index.d.ts CHANGED
@@ -8,33 +8,33 @@ type ButtonVariant = 'contained' | 'outlined' | 'text';
8
8
  type ButtonColor = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
9
9
  type ButtonSize = 'sm' | 'md' | 'lg';
10
10
 
11
- interface Props$9 {
11
+ interface Props$8 {
12
12
  as?: React.ElementType;
13
13
  variant?: ButtonVariant;
14
14
  color?: ButtonColor;
15
15
  size?: ButtonSize;
16
16
  }
17
- type NativeAttrs$2 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$9>;
18
- type ButtonProps = Props$9 & NativeAttrs$2;
19
- declare const Button: react.ForwardRefExoticComponent<Props$9 & NativeAttrs$2 & react.RefAttributes<HTMLButtonElement>>;
17
+ type NativeAttrs$2 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$8>;
18
+ type ButtonProps = Props$8 & NativeAttrs$2;
19
+ declare const Button: react.ForwardRefExoticComponent<Props$8 & NativeAttrs$2 & react.RefAttributes<HTMLButtonElement>>;
20
20
 
21
- interface Props$8 {
21
+ interface Props$7 {
22
22
  as?: React.ElementType;
23
23
  value: any;
24
24
  }
25
- type NativeAttrs$1 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$8>;
26
- type TabProps = Props$8 & NativeAttrs$1;
27
- declare const Tab: react.ForwardRefExoticComponent<Props$8 & NativeAttrs$1 & {
25
+ type NativeAttrs$1 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$7>;
26
+ type TabProps = Props$7 & NativeAttrs$1;
27
+ declare const Tab: react.ForwardRefExoticComponent<Props$7 & NativeAttrs$1 & {
28
28
  children?: react.ReactNode;
29
29
  } & react.RefAttributes<HTMLDivElement>>;
30
30
 
31
- interface Props$7 {
31
+ interface Props$6 {
32
32
  value?: any;
33
33
  defaultValue?: any;
34
34
  onChange?(value: any): void;
35
35
  }
36
- type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$7>;
37
- type TabsProps = Props$7 & NativeAttrs;
36
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$6>;
37
+ type TabsProps = Props$6 & NativeAttrs;
38
38
  declare const Tabs: React.FC<TabsProps>;
39
39
 
40
40
  interface IDropEnumList {
@@ -65,20 +65,20 @@ interface IBreadCrumbContext {
65
65
  setGoBack: (value: boolean) => void;
66
66
  }
67
67
  declare const BreadCrumbContext: react.Context<IBreadCrumbContext>;
68
- interface Props$6 {
68
+ interface Props$5 {
69
69
  children: ReactNode;
70
70
  }
71
- declare const BreadCrumbContextProvider: ({ children }: Props$6) => react_jsx_runtime.JSX.Element;
71
+ declare const BreadCrumbContextProvider: ({ children }: Props$5) => react_jsx_runtime.JSX.Element;
72
72
 
73
73
  interface IDrawerContext {
74
74
  active: boolean;
75
75
  setActive: (value: boolean) => void;
76
76
  }
77
77
  declare const DrawerContext: react.Context<IDrawerContext>;
78
- interface Props$5 {
78
+ interface Props$4 {
79
79
  children: ReactNode;
80
80
  }
81
- declare const DrawerContextProvider: FC<Props$5>;
81
+ declare const DrawerContextProvider: FC<Props$4>;
82
82
 
83
83
  interface GlobalProps {
84
84
  children: ReactNode;
@@ -95,20 +95,20 @@ interface IHistoryContext {
95
95
  updateList: (list: HistoryPath) => void;
96
96
  }
97
97
  declare const HistoryContext: react.Context<IHistoryContext>;
98
- interface Props$4 {
98
+ interface Props$3 {
99
99
  children: React.ReactNode;
100
100
  }
101
- declare const HistoryContextProvider: ({ children }: Props$4) => react_jsx_runtime.JSX.Element;
101
+ declare const HistoryContextProvider: ({ children }: Props$3) => react_jsx_runtime.JSX.Element;
102
102
 
103
103
  interface ISidebarMainContext {
104
104
  open: boolean;
105
105
  setOpen: (value: boolean) => void;
106
106
  }
107
107
  declare const SidebarMainContext: react.Context<ISidebarMainContext>;
108
- interface Props$3 {
108
+ interface Props$2 {
109
109
  children: ReactNode;
110
110
  }
111
- declare const SidebarMainContextProvider: ({ children }: Props$3) => react_jsx_runtime.JSX.Element;
111
+ declare const SidebarMainContextProvider: ({ children }: Props$2) => react_jsx_runtime.JSX.Element;
112
112
 
113
113
  declare global {
114
114
  interface WindowEventMap {
@@ -148,14 +148,14 @@ interface Helpers {
148
148
  */
149
149
  declare const useStep: (maxStep: number) => [number, Helpers];
150
150
 
151
- interface Props$2 {
151
+ interface Props$1 {
152
152
  title?: string;
153
153
  paths?: {
154
154
  route: string | -1;
155
155
  title: string;
156
156
  }[];
157
157
  }
158
- declare const AppBreadCrumb: ({ title, paths }: Props$2) => react_jsx_runtime.JSX.Element;
158
+ declare const AppBreadCrumb: ({ title, paths }: Props$1) => react_jsx_runtime.JSX.Element;
159
159
  declare const AppBreadCrumbNav: ({ paths }: {
160
160
  paths?: {
161
161
  route: string;
@@ -184,27 +184,35 @@ interface ILoaderProps {
184
184
  declare const AppLoader: FC<ILoaderProps>;
185
185
 
186
186
  interface CustomBtns {
187
+ title?: string;
188
+ render?: React.ReactNode;
187
189
  Icon?: ({ className }: {
188
190
  className: string;
189
191
  }) => JSX.Element;
190
- title: string;
191
- fn: () => void;
192
+ onAction?: () => void;
192
193
  }
193
194
  interface CustomExcel {
194
195
  title: string;
195
- optionFn: () => void;
196
196
  classNameIcon: string;
197
+ onAction: () => void;
197
198
  }
198
- interface Props$1 {
199
- onCreate?: () => void;
199
+ interface ICustomizeColumns {
200
+ disabled?: boolean;
201
+ className?: string;
202
+ entityType: number;
203
+ data: any[];
204
+ onFetched: (columns: any[]) => void;
205
+ }
206
+ interface NavOptionsProps {
200
207
  exportExcel?: CustomExcel[];
208
+ customButtons?: CustomBtns[];
209
+ onCreate?: () => void;
201
210
  onRefresh?: () => void;
202
211
  onSelect?: () => void;
203
212
  onClear?: () => void;
204
213
  onExpandScreen?: () => void;
205
- CustomButtons?: CustomBtns[];
206
214
  }
207
- declare const NavOptions: FC<Props$1>;
215
+ declare const NavOptions: FC<NavOptionsProps>;
208
216
 
209
217
  interface Props {
210
218
  title?: string;
@@ -244,4 +252,4 @@ interface MainProps {
244
252
  declare const Main: styled_components.StyledComponent<"main", any, MainProps, never>;
245
253
  declare const CloseIcon: styled_components.StyledComponent<"button", any, {}, never>;
246
254
 
247
- export { AppBreadCrumb, AppBreadCrumbNav, AppLoader, BreadCrumbContext, BreadCrumbContextProvider, BreadCrumbTitle, Breadcrumb, Button, ButtonColor, ButtonProps, ButtonSize, ButtonVariant, CloseIcon, CustomBtns, CustomExcel, DrawerContext, DrawerContextProvider, DropEnumList, GlobalProps, GlobalProvider, HistoryContext, HistoryContextProvider, IBreadCrumbContext, ILoaderProps, ItemLinkSidebar, ItemSidebar, LoaderGrid, LoadingType, Main, MenuItem, MenuOptions, MenuTitle, NavOptions, Navbar, SidebarMainContext, SidebarMainContextProvider, SidebarNavigation, Tab, TabProps, Tabs, TabsProps, Title, useLocalStorage, usePrevious, useStep };
255
+ export { AppBreadCrumb, AppBreadCrumbNav, AppLoader, BreadCrumbContext, BreadCrumbContextProvider, BreadCrumbTitle, Breadcrumb, Button, ButtonColor, ButtonProps, ButtonSize, ButtonVariant, CloseIcon, CustomBtns, CustomExcel, DrawerContext, DrawerContextProvider, DropEnumList, GlobalProps, GlobalProvider, HistoryContext, HistoryContextProvider, IBreadCrumbContext, ICustomizeColumns, ILoaderProps, ItemLinkSidebar, ItemSidebar, LoaderGrid, LoadingType, Main, MenuItem, MenuOptions, MenuTitle, NavOptions, NavOptionsProps, Navbar, SidebarMainContext, SidebarMainContextProvider, SidebarNavigation, Tab, TabProps, Tabs, TabsProps, Title, useLocalStorage, usePrevious, useStep };