@unifiedsoftware/react-ui 1.0.8-beta → 1.0.10

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,333 @@
1
+ import * as react from 'react';
2
+ import react__default, { Dispatch, SetStateAction } from 'react';
3
+
4
+ type BadgePlacement = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
5
+
6
+ interface Props$6 {
7
+ /**
8
+ * The placement of the badge relative to its content.
9
+ */
10
+ placement?: BadgePlacement;
11
+ /**
12
+ * The content to display within the badge.
13
+ */
14
+ content?: React.ReactNode;
15
+ }
16
+ type NativeAttrs$6 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$6>;
17
+ type BadgeProps = Props$6 & NativeAttrs$6;
18
+ declare const Badge: React.FC<BadgeProps>;
19
+
20
+ type ButtonVariant = 'filled' | 'outlined' | 'text' | 'plain';
21
+ type ButtonColor = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
22
+ type ButtonSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
23
+
24
+ interface Props$5 {
25
+ /**
26
+ * The HTML element type or React component to render as the button.
27
+ */
28
+ as?: React.ElementType;
29
+ /**
30
+ * The variant style of the button.
31
+ */
32
+ variant?: ButtonVariant;
33
+ /**
34
+ * The color of the button.
35
+ */
36
+ color?: ButtonColor;
37
+ /**
38
+ * The size of the button.
39
+ */
40
+ size?: ButtonSize;
41
+ /**
42
+ * Content to display as an icon within the button. Typically an icon component.
43
+ */
44
+ iconOnly?: React.ReactNode;
45
+ /**
46
+ * Content to display at the start of the button, before the button's text.
47
+ */
48
+ startContent?: React.ReactNode;
49
+ /**
50
+ * Content to display at the end of the button, after the button's text.
51
+ */
52
+ endContent?: React.ReactNode;
53
+ /**
54
+ * Whether the button is in a loading state.
55
+ */
56
+ loading?: boolean;
57
+ /**
58
+ * Whether the button is disabled.
59
+ */
60
+ disabled?: boolean;
61
+ }
62
+ type NativeAttrs$5 = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof Props$5>;
63
+ type ButtonProps = Props$5 & NativeAttrs$5;
64
+ declare const Button: react.ForwardRefExoticComponent<Props$5 & NativeAttrs$5 & react.RefAttributes<HTMLButtonElement>>;
65
+
66
+ type ChipVariant = 'filled' | 'outlined' | 'text';
67
+ type ChipColor = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger';
68
+ type ChipSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
69
+
70
+ interface Props$4 {
71
+ /**
72
+ * The HTML element type or React component to render as the chip.
73
+ */
74
+ as?: React.ElementType;
75
+ /**
76
+ * The variant style of the chip.
77
+ */
78
+ variant?: ChipVariant;
79
+ /**
80
+ * The color of the chip.
81
+ */
82
+ color?: ChipColor;
83
+ /**
84
+ * The size of the chip.
85
+ */
86
+ size?: ChipSize;
87
+ }
88
+ type NativeAttrs$4 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$4>;
89
+ type ChipProps = Props$4 & NativeAttrs$4;
90
+ declare const Chip: react.ForwardRefExoticComponent<Props$4 & NativeAttrs$4 & react.RefAttributes<HTMLDivElement>>;
91
+
92
+ interface CollapseProps {
93
+ children: React.ReactNode;
94
+ isOpen?: boolean;
95
+ onOpen?: () => void;
96
+ onClose?: () => void;
97
+ onToggle?: () => void;
98
+ }
99
+ declare const Collapse: React.FC<CollapseProps>;
100
+
101
+ interface CollapseContentProps {
102
+ children: React.ReactNode;
103
+ }
104
+ declare const CollapseContent: React.FC<CollapseContentProps>;
105
+
106
+ interface CollapseContextValue {
107
+ collapseRef: React.MutableRefObject<HTMLDivElement | null>;
108
+ isOpen: boolean;
109
+ heightAuto: boolean;
110
+ onOpen: () => void;
111
+ onClose: () => void;
112
+ onToggle: () => void;
113
+ }
114
+ declare const CollapseContext: react.Context<CollapseContextValue | null>;
115
+ declare const useCollapse: () => CollapseContextValue;
116
+
117
+ interface CollapseTriggerProps {
118
+ children: react__default.ReactNode;
119
+ }
120
+ declare const CollapseTrigger: react__default.FC<CollapseTriggerProps>;
121
+
122
+ interface IconProps {
123
+ children: React.ReactNode;
124
+ color?: 'primary' | 'secondary';
125
+ size?: 'sm' | 'md' | 'lg';
126
+ }
127
+ declare const Icon: react.ForwardRefExoticComponent<IconProps & react.RefAttributes<unknown>>;
128
+
129
+ interface Props$3 {
130
+ /**
131
+ * The HTML element type or React component to render as the menu item.
132
+ */
133
+ as?: React.ElementType;
134
+ /**
135
+ * The value associated with the menu item.
136
+ */
137
+ value?: any;
138
+ /**
139
+ * The title to display for the menu item.
140
+ */
141
+ title: string;
142
+ /**
143
+ * Optional icon to display with the menu item.
144
+ */
145
+ icon?: React.ReactNode;
146
+ /**
147
+ * The nesting level of the menu item, for hierarchical menus.
148
+ */
149
+ level?: number;
150
+ /**
151
+ * Whether the item is disabled.
152
+ */
153
+ disabled?: boolean;
154
+ }
155
+ type NativeAttrs$3 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$3 | 'items'>;
156
+ type MenuItemProps = Props$3 & NativeAttrs$3;
157
+ declare const MenuItem: react.ForwardRefExoticComponent<Props$3 & NativeAttrs$3 & {
158
+ children?: react.ReactNode;
159
+ } & react.RefAttributes<HTMLDivElement>>;
160
+
161
+ type MenuSubmenuProps = Omit<MenuItemProps, 'items'> & {
162
+ items?: MenuItemType[];
163
+ };
164
+ declare const MenuSubmenu: React.FC<MenuSubmenuProps>;
165
+
166
+ type MenuGroupItemType = (MenuItemProps & {
167
+ type?: 'item';
168
+ }) | (MenuSubmenuProps & {
169
+ type?: 'submenu';
170
+ });
171
+ type MenuGroupProps = Omit<MenuItemProps, 'items'> & {
172
+ items?: MenuGroupItemType[];
173
+ };
174
+ declare const MenuGroup: React.FC<MenuGroupProps>;
175
+
176
+ type MenuItemType = (MenuGroupProps & {
177
+ type?: 'group';
178
+ }) | (MenuSubmenuProps & {
179
+ type?: 'submenu';
180
+ }) | (MenuItemProps & {
181
+ type?: 'item';
182
+ });
183
+ interface Props$2 {
184
+ /**
185
+ * The currently selected value of the menu.
186
+ */
187
+ value?: any[];
188
+ /**
189
+ * The default value of the menu when initially rendered.
190
+ */
191
+ defaultValue?: any[];
192
+ /**
193
+ * An array of values that represent open submenus in the menu.
194
+ */
195
+ openValues?: any[];
196
+ /**
197
+ * The expand mode of the menu, which can be 'single' or 'multiple'.
198
+ */
199
+ expandMode?: 'single' | 'multiple';
200
+ /**
201
+ * The nav mode of the menu, which can be 'manual' or 'automatic'.
202
+ * Search for the last level of the menu and validate if the value matches.
203
+ */
204
+ navMode?: 'manual' | 'automatic';
205
+ /**
206
+ * A callback function called when the selected values of the menu change.
207
+ */
208
+ onChange?: (value: any[]) => void;
209
+ /**
210
+ * A callback function called when submenus are opened.
211
+ */
212
+ onOpen?: (values: any[]) => void;
213
+ /**
214
+ * A callback function called when a menu item is selected.
215
+ * @param {MenuItemProps} props - The properties of the selected menu item.
216
+ */
217
+ onItemSelect?: (props: MenuItemProps) => void;
218
+ }
219
+ type NativeAttrs$2 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$2 | 'items'>;
220
+ type MenuProps = Props$2 & NativeAttrs$2 & {
221
+ items: MenuItemType[];
222
+ };
223
+ declare const Menu: React.FC<MenuProps>;
224
+
225
+ interface MenuContextValue {
226
+ value: any;
227
+ originalValue: any;
228
+ openValues: any[];
229
+ expandMode: 'single' | 'multiple';
230
+ navMode: 'manual' | 'automatic';
231
+ onChange: (value: any) => void;
232
+ onOpen: (values: any) => void;
233
+ onItemSelect: (props: MenuItemProps) => void;
234
+ }
235
+ declare const MenuContext: react.Context<MenuContextValue | null>;
236
+ declare const useMenu: () => MenuContextValue;
237
+
238
+ declare const MenuValueContext: react.Context<string[]>;
239
+ declare const useMenuItemValue: () => string[];
240
+
241
+ declare const getOpenValuesByPathname: (pathname: string) => string[];
242
+
243
+ interface Props$1 {
244
+ /**
245
+ * The HTML element type or React component to render as the tab.
246
+ */
247
+ as?: React.ElementType;
248
+ /**
249
+ * The value associated with the tab.
250
+ */
251
+ value?: any;
252
+ /**
253
+ * Whether the tab can be closed.
254
+ */
255
+ closable?: boolean;
256
+ /**
257
+ * Whether the tab is disabled.
258
+ */
259
+ disabled?: boolean;
260
+ }
261
+ type NativeAttrs$1 = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props$1>;
262
+ type TabProps = Props$1 & NativeAttrs$1;
263
+ declare const Tab: react.ForwardRefExoticComponent<Props$1 & NativeAttrs$1 & {
264
+ children?: react.ReactNode;
265
+ } & react.RefAttributes<HTMLDivElement>>;
266
+
267
+ type TabsAlignmet = 'start' | 'center' | 'end' | 'stretch';
268
+
269
+ interface Props {
270
+ /**
271
+ * The currently selected value of the tabs.
272
+ */
273
+ value?: any;
274
+ /**
275
+ * The default value of the tabs when initially rendered.
276
+ */
277
+ defaultValue?: any;
278
+ /**
279
+ * The alignment of the tabs.
280
+ */
281
+ alignment?: TabsAlignmet;
282
+ /**
283
+ * A callback function called when the selected tab value changes.
284
+ */
285
+ onChange?: (value: any) => void;
286
+ /**
287
+ * A callback function called when a tab is closed.
288
+ */
289
+ onClose?: (value: any) => void;
290
+ }
291
+ type NativeAttrs = Omit<React.HTMLAttributes<HTMLDivElement>, keyof Props>;
292
+ type TabsProps = Props & NativeAttrs;
293
+ declare const Tabs: React.FC<TabsProps>;
294
+
295
+ declare global {
296
+ interface WindowEventMap {
297
+ 'local-storage': CustomEvent;
298
+ }
299
+ }
300
+ type SetValue<T> = Dispatch<SetStateAction<T>>;
301
+ /**
302
+ * It's a React hook that allows you to store and retrieve data from localStorage
303
+ * @param {string} key - string
304
+ * @param {T} initialValue - The initial value to use if the key doesn't exist in localStorage.
305
+ * @returns An array of two items. The first item is the value of the local storage key. The second
306
+ * item is a function that can be used to set the value of the local storage key.
307
+ */
308
+ declare function useLocalStorage<T>(key: string, initialValue: T): [T, SetValue<T>];
309
+
310
+ /**
311
+ * It returns the previous value of the given value
312
+ * @param {any} value - any - The value to track.
313
+ * @returns The previous value of the variable.
314
+ */
315
+ declare const usePrevious: (value: any) => undefined;
316
+
317
+ interface Helpers {
318
+ goToNextStep: () => void;
319
+ goToPrevStep: () => void;
320
+ reset: () => void;
321
+ canGoToNextStep: boolean;
322
+ canGoToPrevStep: boolean;
323
+ setStep: Dispatch<SetStateAction<number>>;
324
+ }
325
+ /**
326
+ * It returns a tuple with the current step and an object with functions to manipulate the step
327
+ * @param {number} maxStep - number - The maximum number of steps in the stepper.
328
+ * @returns An array with two elements. The first element is the current step. The second element is an
329
+ * object with the following properties:
330
+ */
331
+ declare const useStep: (maxStep: number) => [number, Helpers];
332
+
333
+ export { Badge, BadgeProps, Button, ButtonColor, ButtonProps, ButtonSize, ButtonVariant, Chip, ChipProps, Collapse, CollapseContent, CollapseContentProps, CollapseContext, CollapseContextValue, CollapseProps, CollapseTrigger, CollapseTriggerProps, Icon, IconProps, Menu, MenuContext, MenuContextValue, MenuGroup, MenuGroupItemType, MenuGroupProps, MenuItem, MenuItemProps, MenuItemType, MenuProps, MenuSubmenu, MenuSubmenuProps, MenuValueContext, Tab, TabProps, Tabs, TabsAlignmet, TabsProps, getOpenValuesByPathname, useCollapse, useLocalStorage, useMenu, useMenuItemValue, usePrevious, useStep };
package/dist/index.d.ts CHANGED
@@ -196,12 +196,12 @@ interface Props$2 {
196
196
  /**
197
197
  * The expand mode of the menu, which can be 'single' or 'multiple'.
198
198
  */
199
- navMode?: 'single' | 'multiple';
199
+ expandMode?: 'single' | 'multiple';
200
200
  /**
201
201
  * The nav mode of the menu, which can be 'manual' or 'automatic'.
202
202
  * Search for the last level of the menu and validate if the value matches.
203
203
  */
204
- openMode?: 'manual' | 'automatic';
204
+ navMode?: 'manual' | 'automatic';
205
205
  /**
206
206
  * A callback function called when the selected values of the menu change.
207
207
  */
@@ -226,8 +226,8 @@ interface MenuContextValue {
226
226
  value: any;
227
227
  originalValue: any;
228
228
  openValues: any[];
229
- navMode: 'single' | 'multiple';
230
- openMode: 'manual' | 'automatic';
229
+ expandMode: 'single' | 'multiple';
230
+ navMode: 'manual' | 'automatic';
231
231
  onChange: (value: any) => void;
232
232
  onOpen: (values: any) => void;
233
233
  onItemSelect: (props: MenuItemProps) => void;