@sentio/ui-core 0.1.0

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,397 @@
1
+ import * as react from 'react';
2
+ import react__default, { FC, PropsWithChildren, SVGProps, ReactNode, MutableRefObject, ReactElement, CSSProperties } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { LoaderHeightWidthProps } from 'react-spinners/helpers/props';
5
+ import * as class_variance_authority_types from 'class-variance-authority/types';
6
+ import { VariantProps } from 'class-variance-authority';
7
+ export { cx as classNames } from 'class-variance-authority';
8
+ import { Strategy, Placement as Placement$1 } from '@floating-ui/react';
9
+ import { OffsetOptions, Placement } from '@floating-ui/core';
10
+ import { UseFormRegisterReturn, FieldError } from 'react-hook-form';
11
+ export { LuSquareX as CloseSquareO, LuEye as EyeO, LuSquareMinus as MinusSquareO, LuSquarePlus as PlusSquareO } from 'react-icons/lu';
12
+ import { ColumnDef, ColumnResizeMode, Row, Cell, TableState } from '@tanstack/react-table';
13
+ import BigDecimal from '@sentio/bigdecimal';
14
+
15
+ interface Props$c {
16
+ hint?: React.ReactNode;
17
+ loading?: boolean;
18
+ className?: string;
19
+ iconClassName?: string;
20
+ width?: LoaderHeightWidthProps['width'];
21
+ gray?: boolean;
22
+ }
23
+ declare function _BarLoading({ hint, loading, className, iconClassName, width, gray }: Props$c): react_jsx_runtime.JSX.Element | null;
24
+ declare const BarLoading: react.MemoExoticComponent<typeof _BarLoading>;
25
+
26
+ interface Props$b {
27
+ loading?: boolean;
28
+ children?: react__default.ReactNode;
29
+ className?: string;
30
+ size?: number;
31
+ showMask?: boolean;
32
+ maskOpacity?: number;
33
+ }
34
+ declare const SpinLoading: (args: Props$b) => react_jsx_runtime.JSX.Element;
35
+
36
+ declare const CopyIcon: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
37
+ declare const CopySuccessIcon: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
38
+ interface Props$a {
39
+ text?: string | Function;
40
+ size?: number;
41
+ ml?: number;
42
+ mr?: number;
43
+ hover?: boolean;
44
+ placement?: 'left' | 'right';
45
+ className?: string;
46
+ }
47
+ declare const CopyButton: FC<PropsWithChildren<Props$a>>;
48
+
49
+ declare const buttonClass: (props?: ({
50
+ role?: "link" | "text" | "dashed" | "primary" | "secondary" | "tertiary" | "tertiarytext" | "custom" | null | undefined;
51
+ status?: "default" | "danger" | null | undefined;
52
+ size?: "default" | "sm" | "md" | "lg" | null | undefined;
53
+ disabled?: boolean | null | undefined;
54
+ position?: "end" | "middle" | "begin" | "full" | null | undefined;
55
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
56
+ interface ButtonProps extends VariantProps<typeof buttonClass> {
57
+ className?: string;
58
+ onClick?: (evt: React.MouseEvent) => void;
59
+ children?: ReactNode;
60
+ type?: 'submit' | 'button' | 'reset';
61
+ processing?: boolean;
62
+ disabledHint?: React.ReactNode;
63
+ disabledHintPortal?: boolean;
64
+ ref?: MutableRefObject<any>;
65
+ icon?: React.ReactElement;
66
+ title?: string;
67
+ value?: string;
68
+ id?: string;
69
+ }
70
+ declare const NewButton: react.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & react.RefAttributes<unknown>>;
71
+
72
+ interface Props$9 {
73
+ title?: string | ReactElement;
74
+ titleBorder?: boolean;
75
+ footerBorder?: boolean;
76
+ children: ReactElement;
77
+ open: boolean;
78
+ onClose: () => void;
79
+ cancelText?: string;
80
+ cancelProps?: ButtonProps;
81
+ onCancel?: () => void;
82
+ okText?: string;
83
+ okProps?: ButtonProps;
84
+ onOk?: () => void;
85
+ buttonsClassName?: string;
86
+ extraButtons?: ReactElement | ReactElement[];
87
+ panelClassName?: string;
88
+ initialFocus?: React.MutableRefObject<HTMLElement | null> | undefined;
89
+ errorMessages?: string;
90
+ footer?: ReactElement;
91
+ zIndex?: number;
92
+ mask?: 'normal' | 'light';
93
+ }
94
+ declare function _BaseDialog({ title, open, onClose, onCancel, cancelText, cancelProps, onOk, okText, okProps, children, buttonsClassName, panelClassName, titleBorder, footerBorder, initialFocus, extraButtons, errorMessages, footer, zIndex, mask }: Props$9): react_jsx_runtime.JSX.Element;
95
+ declare const BaseDialog: react.MemoExoticComponent<typeof _BaseDialog>;
96
+
97
+ interface Props$8 {
98
+ text?: string | react__default.ReactNode;
99
+ className?: string;
100
+ buttonClassName?: string;
101
+ activeButtonClassName?: string;
102
+ icon?: react__default.ReactNode;
103
+ children?: react__default.ReactNode;
104
+ strategy?: Strategy;
105
+ hideArrow?: boolean;
106
+ offsetOptions?: OffsetOptions;
107
+ placementOption?: Placement;
108
+ maxWidth?: string;
109
+ usePortal?: boolean;
110
+ enableFadeAnimation?: boolean;
111
+ animationDuration?: number;
112
+ }
113
+ declare const PopoverTooltip: ({ icon, text, className, buttonClassName, activeButtonClassName, children, strategy: propStrategy, hideArrow, offsetOptions, placementOption, maxWidth, usePortal, enableFadeAnimation, animationDuration }: Props$8) => react_jsx_runtime.JSX.Element;
114
+
115
+ interface Props$7 {
116
+ defaultOpen?: boolean;
117
+ children: ReactNode;
118
+ title: string | ReactNode | ((open: boolean) => ReactNode);
119
+ titleClassName?: string;
120
+ containerClassName?: string;
121
+ iconClassName?: string;
122
+ className?: string;
123
+ }
124
+ declare function DisclosurePanel({ title, children, defaultOpen, className, containerClassName, iconClassName, titleClassName }: Props$7): react_jsx_runtime.JSX.Element;
125
+
126
+ interface CollapseProps {
127
+ title: ReactNode | string;
128
+ children: React.ReactNode;
129
+ className?: string;
130
+ titleClassName?: string;
131
+ defaultOpen?: boolean;
132
+ iconClassName?: string;
133
+ }
134
+ declare const Collapse: ({ title, children, className, titleClassName, defaultOpen, iconClassName }: CollapseProps) => react_jsx_runtime.JSX.Element;
135
+
136
+ type InputProps = UseFormRegisterReturn & {
137
+ error?: FieldError;
138
+ errorClassName?: string;
139
+ size?: 'sm' | 'md' | 'lg';
140
+ className?: string;
141
+ value?: string;
142
+ placeholder?: string;
143
+ } & React.InputHTMLAttributes<HTMLInputElement>;
144
+ declare const Input: react.ForwardRefExoticComponent<Omit<InputProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
145
+
146
+ interface Props$6<T> {
147
+ value?: T;
148
+ onChange?: (v: T) => void;
149
+ label?: string;
150
+ labelClassName?: string;
151
+ containerClassName?: string;
152
+ options: {
153
+ name: string;
154
+ value: T;
155
+ }[];
156
+ vertical?: boolean;
157
+ }
158
+ declare function RadioSelect<T>({ value, onChange, label, labelClassName, options, vertical, containerClassName }: Props$6<T>): react_jsx_runtime.JSX.Element;
159
+
160
+ interface Props$5 {
161
+ checked?: boolean;
162
+ onChange?: (checked: boolean) => void;
163
+ srText?: string;
164
+ size: 'lg' | 'default' | 'sm';
165
+ disabled?: boolean;
166
+ label?: string;
167
+ }
168
+ declare function Switch({ checked, onChange: _onChange, srText, size, disabled, label }: Props$5): react_jsx_runtime.JSX.Element;
169
+
170
+ type labelProps = {
171
+ selected?: boolean;
172
+ active?: boolean;
173
+ };
174
+ interface IOption<T> {
175
+ label: ReactNode | ((props: labelProps) => ReactNode);
176
+ value: T;
177
+ disabled?: boolean;
178
+ title?: string;
179
+ }
180
+ interface SelectProps<T> {
181
+ options: IOption<T>[];
182
+ value: T;
183
+ onChange: (value: T) => void;
184
+ className?: string;
185
+ buttonClassName?: string;
186
+ optionsClassName?: string;
187
+ placeholder?: string;
188
+ size?: 'sm' | 'md';
189
+ renderOption?: (option: IOption<T>, state: labelProps) => ReactElement;
190
+ noOptionsMessage?: ReactElement;
191
+ error?: FieldError;
192
+ disabled?: boolean;
193
+ fetchMore?: () => void;
194
+ isFetchingMore?: boolean;
195
+ scrollBottomThreshold?: number;
196
+ groupedOptions?: boolean;
197
+ groupedOrder?: {
198
+ key: string;
199
+ label: string;
200
+ }[];
201
+ unmountOptions?: boolean;
202
+ direction?: 'up' | 'down';
203
+ asLayer?: boolean;
204
+ }
205
+ declare function Select<T>({ className, buttonClassName, optionsClassName, options, value, onChange, placeholder, size, renderOption, noOptionsMessage, error, disabled, fetchMore, isFetchingMore, scrollBottomThreshold, groupedOptions, groupedOrder, unmountOptions, direction, asLayer }: SelectProps<T>): react_jsx_runtime.JSX.Element;
206
+
207
+ type FieldDataNode<T, ChildFieldName extends string = 'children'> = T & Partial<Record<ChildFieldName, FieldDataNode<T, ChildFieldName>[]>>;
208
+ type DataNode = FieldDataNode<{
209
+ key: KeyType;
210
+ title?: React.ReactNode | ((data: DataNode) => React.ReactNode);
211
+ depth?: number;
212
+ raw?: any;
213
+ }>;
214
+ type KeyType = string | number;
215
+ declare const SUFFIX_NODE_KEY = "selectedKey_after";
216
+ declare const ROOT_KEY = "root";
217
+ interface Props$4 {
218
+ data?: DataNode[];
219
+ defaultExpandAll?: boolean;
220
+ virtual?: boolean;
221
+ rowHeight?: number | ((index: number, isSelected?: boolean) => number);
222
+ height?: CSSProperties['height'];
223
+ onClick?: (item: DataNode) => void;
224
+ suffixNode?: ReactNode;
225
+ expandDepth?: number;
226
+ contentClassName?: string;
227
+ expandIcon?: React.ReactNode;
228
+ collapseIcon?: React.ReactNode;
229
+ scrollToKey?: KeyType;
230
+ scrollIntoView?: boolean;
231
+ isRootKey?: (v: KeyType) => boolean;
232
+ }
233
+ declare const FlatTree: (props: Props$4) => react_jsx_runtime.JSX.Element;
234
+
235
+ interface LinkifyTextProps {
236
+ text: any;
237
+ className?: string;
238
+ isHighlightNumbers?: boolean;
239
+ }
240
+ declare const LinkifyText: react.NamedExoticComponent<LinkifyTextProps>;
241
+
242
+ interface EmptyProps {
243
+ src?: string;
244
+ title?: react__default.ReactNode;
245
+ }
246
+ declare const Empty: (props: EmptyProps) => react_jsx_runtime.JSX.Element;
247
+
248
+ declare enum StatusRole {
249
+ Success = "success",
250
+ Warning = "warning",
251
+ Error = "error",
252
+ Disabled = "disabled",
253
+ Info = "info"
254
+ }
255
+ interface Props$3 {
256
+ status: string | ReactNode;
257
+ className?: string;
258
+ colorClasses?: string;
259
+ roundClasses?: string;
260
+ bubble?: boolean;
261
+ role?: string | StatusRole;
262
+ }
263
+ declare function StatusBadge({ status, className, colorClasses: _colorClasses, roundClasses, bubble, role }: Props$3): react_jsx_runtime.JSX.Element;
264
+
265
+ interface HeaderToolsToggleButtonProps {
266
+ isOpen: boolean;
267
+ onClick: () => void;
268
+ className?: string;
269
+ }
270
+ declare const HeaderToolsToggleButton: ({ isOpen, onClick, className }: HeaderToolsToggleButtonProps) => react_jsx_runtime.JSX.Element;
271
+ interface HeaderToolsContentProps {
272
+ isOpen: boolean;
273
+ children: ReactNode;
274
+ className?: string;
275
+ }
276
+ declare const HeaderToolsContent: ({ isOpen, children, className }: HeaderToolsContentProps) => react_jsx_runtime.JSX.Element | null;
277
+
278
+ interface Props$2 {
279
+ data: any;
280
+ columns: ColumnDef<any>[];
281
+ columnResizeMode: ColumnResizeMode;
282
+ onClick?: (row: Row<any>, cell: Cell<any, any>) => void;
283
+ height?: CSSProperties['height'];
284
+ onFetchMore?: () => void;
285
+ hasMore?: boolean;
286
+ isFetching?: boolean;
287
+ state?: Partial<TableState>;
288
+ onStateChange?: (state: TableState) => void;
289
+ allowSort?: boolean;
290
+ manualSorting?: boolean;
291
+ allowResizeColumn?: boolean;
292
+ allowEditColumn?: boolean;
293
+ onColumnRename?: (data: ColumnDef<any>) => void;
294
+ onColumnRemove?: (data: ColumnDef<any>) => void;
295
+ minSize?: number;
296
+ minWidth?: number;
297
+ rowClassNameFn?: (row: Row<any>) => string;
298
+ enableVirtualization?: boolean;
299
+ estimatedRowHeight?: number;
300
+ overscan?: number;
301
+ }
302
+ declare const ResizeTable: react.MemoExoticComponent<react.ForwardRefExoticComponent<Props$2 & react.RefAttributes<HTMLDivElement>>>;
303
+
304
+ declare const MoveLeftIcon: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
305
+ declare const MoveRightIcon: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
306
+ declare const RenameIcon: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
307
+ declare const DeleteIcon: (props: SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
308
+
309
+ interface IMenuItem {
310
+ key: string;
311
+ label: ReactNode;
312
+ icon?: ReactNode;
313
+ status?: string;
314
+ disabled?: boolean;
315
+ disabledHint?: ReactNode;
316
+ items?: IMenuItem[][];
317
+ data?: any;
318
+ }
319
+ type OnSelectMenuItem = (key: string, event: React.MouseEvent, data?: any) => void;
320
+
321
+ interface Props$1 {
322
+ items: IMenuItem[][];
323
+ groupLabels?: string[];
324
+ buttonIcon: ReactNode | ((menuOpen: boolean) => ReactNode);
325
+ buttonClassName?: string;
326
+ itemsClassName?: string;
327
+ itemLabelClassName?: string;
328
+ onSelect?: OnSelectMenuItem;
329
+ ariaLabel?: string;
330
+ header?: ReactNode;
331
+ footer?: ReactNode;
332
+ renderItem?: (data: IMenuItem) => React.ReactNode;
333
+ placement?: Placement$1;
334
+ offset?: any;
335
+ portal?: boolean;
336
+ width?: CSSProperties['width'];
337
+ selectedKey?: IMenuItem['key'];
338
+ onOpenCallback?: () => void;
339
+ }
340
+ declare function PopupMenuButton({ buttonIcon, items, groupLabels, onSelect, ariaLabel, header, footer, buttonClassName, itemsClassName, itemLabelClassName, renderItem, placement, offset, portal, width, selectedKey, onOpenCallback }: Props$1): react_jsx_runtime.JSX.Element;
341
+
342
+ declare const COLOR_MAP: Record<string, {
343
+ active: string;
344
+ default: string;
345
+ disabled: string;
346
+ }>;
347
+ declare const MenuContext: react.Context<{
348
+ selectedKey?: string;
349
+ }>;
350
+ type Props = IMenuItem & {
351
+ items: IMenuItem[][];
352
+ onSelect?: OnSelectMenuItem;
353
+ active: boolean;
354
+ name: string;
355
+ placement?: Placement$1;
356
+ buttonClass?: string;
357
+ };
358
+ interface ItemProps {
359
+ item: IMenuItem;
360
+ onSelect?: OnSelectMenuItem;
361
+ labelClassName?: string;
362
+ }
363
+ declare const MenuItem: ({ item, onSelect, labelClassName }: ItemProps) => react_jsx_runtime.JSX.Element;
364
+ declare const SubMenuButton: (props: Props) => react_jsx_runtime.JSX.Element;
365
+
366
+ declare const BD: typeof BigDecimal;
367
+ declare function parseHex(hex?: string): bigint;
368
+ declare function getNumberWithDecimal(hex?: string | bigint, decimal?: number, asNumber?: boolean): string | number | null;
369
+
370
+ /**
371
+ * React Hook for detecting mobile devices
372
+ * @param breakpoint Breakpoint width, default 768px
373
+ * @returns boolean Whether it's a mobile device
374
+ */
375
+ declare function useMobile(breakpoint?: number, defaultValue?: boolean): boolean;
376
+
377
+ declare function useBoolean(defaultValue?: boolean): {
378
+ value: boolean;
379
+ setValue: react.Dispatch<react.SetStateAction<boolean>>;
380
+ setTrue: () => void;
381
+ setFalse: () => void;
382
+ toggle: () => void;
383
+ };
384
+
385
+ declare const SvgFolderContext: react.Context<string>;
386
+ declare const useDetectExtenstion: () => boolean;
387
+ declare const DarkModeContext: react.Context<boolean>;
388
+ declare const useDarkMode: () => boolean;
389
+
390
+ declare const NavSizeContext: react.Context<{
391
+ small: boolean;
392
+ showLabel: boolean;
393
+ setSmall: (small: boolean) => void;
394
+ setShowLabel: (showLabel: boolean) => void;
395
+ }>;
396
+
397
+ export { BD, BarLoading, BaseDialog, NewButton as Button, COLOR_MAP, Collapse, CopyButton, CopyIcon, CopySuccessIcon, DarkModeContext, type DataNode, DeleteIcon, DisclosurePanel, Empty, FlatTree, HeaderToolsContent, HeaderToolsToggleButton, type IMenuItem, Input, LinkifyText, MenuContext, MenuItem, MoveLeftIcon, MoveRightIcon, NavSizeContext, type OnSelectMenuItem, PopoverTooltip, PopupMenuButton, ROOT_KEY, RadioSelect, RenameIcon, ResizeTable, SUFFIX_NODE_KEY, Select, type SelectProps, SpinLoading, StatusBadge, StatusRole, SubMenuButton, SvgFolderContext, Switch, getNumberWithDecimal, parseHex, useBoolean, useDarkMode, useDetectExtenstion, useMobile };