@martinsura/ui 0.1.2 → 0.1.4

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
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as class_variance_authority_types from 'class-variance-authority/types';
3
3
  import * as react from 'react';
4
- import { ComponentType, ReactElement, ReactNode } from 'react';
4
+ import { ComponentType, ReactElement, ReactNode, RefObject } from 'react';
5
5
  import { VariantProps } from 'class-variance-authority';
6
6
  import * as _tabler_icons_react from '@tabler/icons-react';
7
7
 
@@ -51,7 +51,7 @@ type IconProps = {
51
51
  className?: string;
52
52
  };
53
53
  declare const buttonVariants: (props?: ({
54
- variant?: "link" | "default" | "primary" | "danger" | "success" | "ghost" | null | undefined;
54
+ variant?: "link" | "text" | "default" | "primary" | "danger" | "success" | "subtle" | "ghost" | null | undefined;
55
55
  size?: "small" | "middle" | "large" | null | undefined;
56
56
  block?: boolean | null | undefined;
57
57
  shape?: "circle" | "default" | "round" | null | undefined;
@@ -71,17 +71,33 @@ type ButtonProps = {
71
71
  iconType?: UiIconType;
72
72
  iconPosition?: "left" | "right";
73
73
  block?: boolean;
74
+ fullWidthOnMobile?: boolean;
74
75
  size?: ButtonSize;
75
76
  iconSize?: number;
76
77
  confirm?: ConfirmOptions;
77
78
  shape?: "default" | "circle" | "round";
79
+ iconOnly?: boolean;
78
80
  classNames?: {
79
81
  icon?: string;
80
82
  content?: string;
81
83
  spinner?: string;
82
84
  };
83
85
  };
84
- declare const Button: ({ variant, size, shape, block, iconPosition, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
86
+ declare const Button: ({ variant, size, shape, block, fullWidthOnMobile, iconPosition, ...props }: ButtonProps) => react_jsx_runtime.JSX.Element;
87
+
88
+ type ConfirmButtonProps = {
89
+ text?: string;
90
+ children?: ReactNode;
91
+ onClick?: () => void;
92
+ disabled?: boolean;
93
+ loading?: boolean;
94
+ variant?: ButtonVariant;
95
+ size?: ButtonSize;
96
+ icon?: ComponentType<IconProps>;
97
+ className?: string;
98
+ confirm: ConfirmOptions;
99
+ };
100
+ declare const ConfirmButton: (props: ConfirmButtonProps) => react_jsx_runtime.JSX.Element;
85
101
 
86
102
  type InputFieldProps = {
87
103
  children: ReactNode;
@@ -139,7 +155,23 @@ type TextInputProps = {
139
155
  error?: string;
140
156
  };
141
157
  };
142
- declare const TextInput: ({ size, password, newPassword, ...props }: TextInputProps) => react_jsx_runtime.JSX.Element;
158
+ declare const TextInput: react.ForwardRefExoticComponent<TextInputProps & react.RefAttributes<HTMLInputElement>>;
159
+
160
+ type TextareaProps = {
161
+ label?: string;
162
+ placeholder?: string;
163
+ value?: string | null;
164
+ onChange?: (value: string) => void;
165
+ rows?: number;
166
+ required?: boolean;
167
+ disabled?: boolean;
168
+ className?: string;
169
+ error?: ReactNode;
170
+ customError?: ReactNode;
171
+ errorName?: string;
172
+ noMargin?: boolean;
173
+ };
174
+ declare const Textarea: ({ rows, ...props }: TextareaProps) => react_jsx_runtime.JSX.Element;
143
175
 
144
176
  type NumberInputProps = {
145
177
  label?: string;
@@ -185,6 +217,28 @@ type CheckboxInputProps = {
185
217
  };
186
218
  declare const CheckboxInput: ({ value, ...props }: CheckboxInputProps) => react_jsx_runtime.JSX.Element;
187
219
 
220
+ type RadioOption<T extends string = string> = {
221
+ label: ReactNode;
222
+ value: T;
223
+ description?: ReactNode;
224
+ disabled?: boolean;
225
+ };
226
+ type RadioGroupProps<T extends string = string> = {
227
+ label?: string;
228
+ value?: T | null;
229
+ onChange?: (value: T) => void;
230
+ options: RadioOption<T>[];
231
+ direction?: "row" | "column";
232
+ required?: boolean;
233
+ disabled?: boolean;
234
+ error?: ReactNode;
235
+ customError?: ReactNode;
236
+ errorName?: string;
237
+ className?: string;
238
+ noMargin?: boolean;
239
+ };
240
+ declare const RadioGroup: <T extends string = string>({ direction, ...props }: RadioGroupProps<T>) => react_jsx_runtime.JSX.Element;
241
+
188
242
  type SwitchInputProps = {
189
243
  label?: string;
190
244
  value?: boolean | null;
@@ -247,6 +301,30 @@ type ColorInputProps = {
247
301
  };
248
302
  declare const ColorInput: ({ size, placeholder, presets, allowClear, variant, showAlpha, ...props }: ColorInputProps) => react_jsx_runtime.JSX.Element;
249
303
 
304
+ type SearchInputProps = {
305
+ label?: string;
306
+ value?: string | null;
307
+ onChange?: (value: string) => void;
308
+ onClear?: () => void;
309
+ placeholder?: string;
310
+ className?: string;
311
+ error?: ReactNode;
312
+ customError?: ReactNode;
313
+ errorName?: string;
314
+ noMargin?: boolean;
315
+ };
316
+ declare const SearchInput: ({ ...props }: SearchInputProps) => react_jsx_runtime.JSX.Element;
317
+
318
+ type InlineEditProps = {
319
+ label?: ReactNode;
320
+ value?: string | null;
321
+ placeholder?: string;
322
+ multiline?: boolean;
323
+ onSave?: (value: string) => void;
324
+ className?: string;
325
+ };
326
+ declare const InlineEdit: ({ value, placeholder, multiline, onSave, label, className }: InlineEditProps) => react_jsx_runtime.JSX.Element;
327
+
250
328
  type TableSize = "small" | "middle" | "large";
251
329
  type ColumnType = "date" | "datetime" | "yes/no" | "boolean" | "dot";
252
330
  type TableColumn<T> = {
@@ -333,6 +411,7 @@ type GridProps<T, TSortField = never, TFilter extends object = Record<string, ne
333
411
  selection?: GridSelection<T>;
334
412
  onRowClick?: (item: T) => void;
335
413
  verticalBorders?: boolean;
414
+ attachedTop?: boolean;
336
415
  showPageNumberChanger?: boolean;
337
416
  showPageSizeChanger?: boolean;
338
417
  className?: string;
@@ -504,6 +583,64 @@ type DrawerContextValue = {
504
583
  };
505
584
  declare function useDrawer(): DrawerContextValue;
506
585
 
586
+ type ModalPlacement = "center" | "fullscreen";
587
+ type ModalSize = "small" | "middle" | "large" | "auto";
588
+ type ModalProps = {
589
+ isOpen: boolean;
590
+ onClose: (saved: boolean) => void;
591
+ children: ReactNode;
592
+ placement?: ModalPlacement;
593
+ size?: ModalSize;
594
+ width?: number | string;
595
+ maxWidth?: number | string;
596
+ closeOnEscape?: boolean;
597
+ closeOnOverlayClick?: boolean;
598
+ showCloseButton?: boolean;
599
+ hideHeader?: boolean;
600
+ destroyOnClose?: boolean;
601
+ preventClose?: boolean;
602
+ beforeClose?: () => boolean | Promise<boolean>;
603
+ initialFocusRef?: RefObject<HTMLElement | null>;
604
+ className?: string;
605
+ classNames?: {
606
+ overlay?: string;
607
+ panel?: string;
608
+ header?: string;
609
+ title?: string;
610
+ closeButton?: string;
611
+ body?: string;
612
+ loading?: string;
613
+ footer?: string;
614
+ };
615
+ };
616
+ declare const Modal: ({ placement, size, width, maxWidth, closeOnEscape, closeOnOverlayClick, showCloseButton, hideHeader, destroyOnClose, preventClose, beforeClose, initialFocusRef, ...props }: ModalProps) => react.ReactPortal | null;
617
+
618
+ type ModalTitleProps = {
619
+ children: ReactNode;
620
+ };
621
+ declare const ModalTitle: ({ children }: ModalTitleProps) => null;
622
+
623
+ type ModalFooterProps = {
624
+ children: ReactNode;
625
+ align?: "left" | "center" | "right";
626
+ };
627
+ declare const ModalFooter: ({ children, align }: ModalFooterProps) => null;
628
+
629
+ type ModalContentProps = {
630
+ children: ReactNode;
631
+ loading?: boolean;
632
+ };
633
+ declare const ModalContent: ({ loading, children }: ModalContentProps) => react_jsx_runtime.JSX.Element;
634
+
635
+ type ModalContextValue = {
636
+ close: () => void;
637
+ saveAndClose: (message?: string) => void;
638
+ setTitle: (title: string) => void;
639
+ setFooter: (footer: ReactNode) => void;
640
+ setLoading: (loading: boolean) => void;
641
+ };
642
+ declare function useModal(): ModalContextValue;
643
+
507
644
  type PanelProps = {
508
645
  title?: string;
509
646
  children?: ReactNode;
@@ -524,24 +661,95 @@ type PanelProps = {
524
661
  };
525
662
  declare const Panel: ({ variant, inner, ...props }: PanelProps) => react_jsx_runtime.JSX.Element;
526
663
 
664
+ type ToolbarProps = {
665
+ children?: ReactNode;
666
+ start?: ReactNode;
667
+ end?: ReactNode;
668
+ wrapped?: boolean;
669
+ inset?: boolean;
670
+ className?: string;
671
+ classNames?: {
672
+ start?: string;
673
+ end?: string;
674
+ };
675
+ };
676
+ declare const Toolbar: ({ children, start, end, wrapped, inset, className, classNames }: ToolbarProps) => react_jsx_runtime.JSX.Element;
677
+ declare const ActionBar: ({ children, start, end, wrapped, inset, className, classNames }: ToolbarProps) => react_jsx_runtime.JSX.Element;
678
+
679
+ type SectionHeaderProps = {
680
+ title: ReactNode;
681
+ subtitle?: ReactNode;
682
+ actions?: ReactNode;
683
+ className?: string;
684
+ };
685
+ declare const SectionHeader: ({ title, subtitle, actions, className }: SectionHeaderProps) => react_jsx_runtime.JSX.Element;
686
+
687
+ type PageHeaderProps = {
688
+ title: ReactNode;
689
+ subtitle?: ReactNode;
690
+ breadcrumbs?: ReactNode;
691
+ actions?: ReactNode;
692
+ extra?: ReactNode;
693
+ className?: string;
694
+ };
695
+ declare const PageHeader: ({ title, subtitle, breadcrumbs, actions, extra, className }: PageHeaderProps) => react_jsx_runtime.JSX.Element;
696
+
697
+ type EntityHeaderProps = {
698
+ title: ReactNode;
699
+ subtitle?: ReactNode;
700
+ avatarName?: string;
701
+ icon?: ComponentType<IconProps>;
702
+ meta?: ReactNode;
703
+ tags?: ReactNode;
704
+ actions?: ReactNode;
705
+ className?: string;
706
+ };
707
+ declare const EntityHeader: ({ title, subtitle, avatarName, icon: Icon, meta, tags, actions, className }: EntityHeaderProps) => react_jsx_runtime.JSX.Element;
708
+
709
+ type FormActionsProps = {
710
+ children: ReactNode;
711
+ align?: "left" | "center" | "right" | "between";
712
+ className?: string;
713
+ };
714
+ declare const FormActions: ({ children, align, className }: FormActionsProps) => react_jsx_runtime.JSX.Element;
715
+
716
+ type FormSectionProps = {
717
+ title: ReactNode;
718
+ description?: ReactNode;
719
+ actions?: ReactNode;
720
+ children: ReactNode;
721
+ className?: string;
722
+ };
723
+ declare const FormSection: ({ title, description, actions, children, className }: FormSectionProps) => react_jsx_runtime.JSX.Element;
724
+ declare const Fieldset: ({ title, description, actions, children, className }: FormSectionProps) => react_jsx_runtime.JSX.Element;
725
+
527
726
  type TabOption<T extends string = string> = {
528
727
  label: React.ReactNode;
529
728
  value: T;
729
+ icon?: React.ReactNode;
730
+ badge?: React.ReactNode;
731
+ disabled?: boolean;
530
732
  };
733
+ type TabsVariant = "segmented" | "underline" | "cards";
734
+ type TabsSize = "small" | "middle" | "large";
531
735
  type TabsProps<T extends string = string> = {
532
736
  options: TabOption<T>[];
533
737
  value: T;
534
738
  onChange: (value: T) => void;
535
739
  block?: boolean;
740
+ variant?: TabsVariant;
741
+ size?: TabsSize;
536
742
  className?: string;
537
743
  classNames?: {
538
744
  list?: string;
539
745
  tab?: string;
540
746
  activeTab?: string;
541
747
  inactiveTab?: string;
748
+ icon?: string;
749
+ badge?: string;
542
750
  };
543
751
  };
544
- declare const Tabs: <T extends string = string>({ block, ...props }: TabsProps<T>) => react_jsx_runtime.JSX.Element;
752
+ declare const Tabs: <T extends string = string>({ block, variant, size, ...props }: TabsProps<T>) => react_jsx_runtime.JSX.Element;
545
753
 
546
754
  type TagColor = "geekblue" | "blue" | "green" | "cyan" | "red" | "volcano" | "orange" | "gold" | "purple" | "magenta" | "gray" | "default";
547
755
  type TagVariant = "outlined" | "filled";
@@ -849,7 +1057,7 @@ declare const useNotification: () => {
849
1057
  type EmptyProps = {
850
1058
  text?: string;
851
1059
  description?: string;
852
- icon?: React.FC<{
1060
+ icon?: ComponentType<{
853
1061
  size?: number | string;
854
1062
  strokeWidth?: number;
855
1063
  className?: string;
@@ -859,6 +1067,58 @@ type EmptyProps = {
859
1067
  };
860
1068
  declare const Empty: ({ text, description, icon: Icon, className, size, }: EmptyProps) => react_jsx_runtime.JSX.Element;
861
1069
 
1070
+ type EmptyStateProps = {
1071
+ text?: string;
1072
+ description?: string;
1073
+ icon?: EmptyProps["icon"];
1074
+ size?: "default" | "compact";
1075
+ primaryActionText?: string;
1076
+ onPrimaryAction?: () => void;
1077
+ secondaryActionText?: string;
1078
+ onSecondaryAction?: () => void;
1079
+ extra?: ReactNode;
1080
+ className?: string;
1081
+ classNames?: {
1082
+ actions?: string;
1083
+ extra?: string;
1084
+ };
1085
+ };
1086
+ declare const EmptyState: ({ primaryActionText, onPrimaryAction, secondaryActionText, onSecondaryAction, extra, className, classNames, ...props }: EmptyStateProps) => react_jsx_runtime.JSX.Element;
1087
+
1088
+ type StatTrendDirection = "up" | "down" | "neutral";
1089
+ type StatCardProps = {
1090
+ label: string;
1091
+ value: ReactNode;
1092
+ description?: ReactNode;
1093
+ icon?: ComponentType<IconProps>;
1094
+ trend?: {
1095
+ value: ReactNode;
1096
+ direction?: StatTrendDirection;
1097
+ label?: string;
1098
+ };
1099
+ footer?: ReactNode;
1100
+ className?: string;
1101
+ };
1102
+ declare const StatCard: ({ label, value, description, icon: Icon, trend, footer, className }: StatCardProps) => react_jsx_runtime.JSX.Element;
1103
+
1104
+ type DescriptionItem = {
1105
+ label: ReactNode;
1106
+ value: ReactNode;
1107
+ span?: 1 | 2 | 3;
1108
+ };
1109
+ type DescriptionListProps = {
1110
+ items: DescriptionItem[];
1111
+ columns?: 1 | 2 | 3;
1112
+ className?: string;
1113
+ };
1114
+ declare const DescriptionList: ({ items, columns, className }: DescriptionListProps) => react_jsx_runtime.JSX.Element;
1115
+ type KeyValueProps = {
1116
+ label: ReactNode;
1117
+ value: ReactNode;
1118
+ className?: string;
1119
+ };
1120
+ declare const KeyValue: ({ label, value, className }: KeyValueProps) => react_jsx_runtime.JSX.Element;
1121
+
862
1122
  type PrettyProps = {
863
1123
  data: unknown;
864
1124
  className?: string;
@@ -875,6 +1135,13 @@ type SkeletonProps = {
875
1135
  };
876
1136
  declare const Skeleton: ({ active, title, paragraph, className, }: SkeletonProps) => react_jsx_runtime.JSX.Element;
877
1137
 
1138
+ type SkeletonTableProps = {
1139
+ rows?: number;
1140
+ columns?: number;
1141
+ className?: string;
1142
+ };
1143
+ declare const SkeletonTable: ({ rows, columns, className }: SkeletonTableProps) => react_jsx_runtime.JSX.Element;
1144
+
878
1145
  type DropdownDivider = {
879
1146
  divider: true;
880
1147
  visible?: boolean;
@@ -938,6 +1205,29 @@ type TooltipProps = {
938
1205
  };
939
1206
  declare const Tooltip: ({ title, children, placement, open: controlledOpen, onOpenChange, maxWidth, className, contentClassName, arrow, classNames, }: TooltipProps) => react_jsx_runtime.JSX.Element;
940
1207
 
1208
+ type StepperItem = {
1209
+ title: ReactNode;
1210
+ description?: ReactNode;
1211
+ status?: "complete" | "current" | "upcoming";
1212
+ };
1213
+ type StepperProps = {
1214
+ items: StepperItem[];
1215
+ className?: string;
1216
+ };
1217
+ declare const Stepper: ({ items, className }: StepperProps) => react_jsx_runtime.JSX.Element;
1218
+
1219
+ type TimelineItem = {
1220
+ title: ReactNode;
1221
+ description?: ReactNode;
1222
+ time?: ReactNode;
1223
+ color?: "primary" | "success" | "danger" | "warning" | "neutral";
1224
+ };
1225
+ type TimelineProps = {
1226
+ items: TimelineItem[];
1227
+ className?: string;
1228
+ };
1229
+ declare const Timeline: ({ items, className }: TimelineProps) => react_jsx_runtime.JSX.Element;
1230
+
941
1231
  declare const uiTheme: {
942
1232
  colors: {
943
1233
  primary: {
@@ -1191,4 +1481,4 @@ type UiThemeConfig = {
1191
1481
  };
1192
1482
  declare function initUI(config?: UiThemeConfig): void;
1193
1483
 
1194
- export { ActiveTag, type ActiveTagProps, Alert, type AlertProps, type AlertType, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, Button, type ButtonSize, type ButtonVariant, CheckboxInput, type CheckboxInputProps, ColorInput, type ColorInputProps, type ColumnType, type ConfirmOptions, DateInput, type DateInputProps, Drawer, DrawerContent, DrawerFooter, type DrawerPlacement, type DrawerProps, DrawerTitle, Dropdown, type DropdownOption, type DropdownPlacement, type DropdownProps, Empty, type EmptyProps, ErrorProvider, FilterCheckboxInput, FilterDateInput, type FilterDateRangeGroup, FilterDateRangePopover, type FilterDescriptor, FilterNumberInput, type FilterSelectGroupItem, FilterSelectGroupPopover, FilterSelectInput, FilterTextInput, FlagTag, type FlagTagProps, Grid, type GridApiQuery, type GridColumn, GridFilters, type GridHandle, type GridProps, type GridState, HtmlInput, type HtmlInputProps, type IconProps, InputError, InputField, InputLabel, MultiSelectInput, type MultiSelectInputProps, type NotificationOptions, NotificationProvider, type NotificationType, NumberInput, type NumberInputProps, Panel, type PanelProps, Popconfirm, type PopconfirmProps, Pretty, type PrettyProps, SelectInput, type SelectInputProps, ServerError, type ServerErrorValue, Skeleton, type SkeletonProps, SortDirection, Spinner, type SpinnerColor, type SpinnerProps, SwitchInput, type SwitchInputProps, type TabOption, Table, type TableColumn, type TableProps, type TableSize, Tabs, type TabsProps, Tag, type TagProps, TextInput, type TextInputProps, Tooltip, type TooltipPlacement, type TooltipProps, type UiColor, type UiDefaultIconType, type UiIconType, type UiSize, type UiThemeConfig, type UploadConfig, UploadInput, type UploadInputProps, type UploadItem, UploadProvider, type UploadStatus, getIcon, initUI, notification, registerIcons, uiTheme, useDrawer, useGrid, useNotification, useUploadConfig };
1484
+ export { ActionBar, ActiveTag, type ActiveTagProps, Alert, type AlertProps, type AlertType, Avatar, type AvatarProps, type AvatarSize, Badge, type BadgeProps, Button, type ButtonSize, type ButtonVariant, CheckboxInput, type CheckboxInputProps, ColorInput, type ColorInputProps, type ColumnType, ConfirmButton, type ConfirmButtonProps, type ConfirmOptions, DateInput, type DateInputProps, type DescriptionItem, DescriptionList, type DescriptionListProps, Drawer, DrawerContent, DrawerFooter, type DrawerPlacement, type DrawerProps, DrawerTitle, Dropdown, type DropdownOption, type DropdownPlacement, type DropdownProps, Empty, type EmptyProps, EmptyState, type EmptyStateProps, EntityHeader, type EntityHeaderProps, ErrorProvider, Fieldset, FilterCheckboxInput, FilterDateInput, type FilterDateRangeGroup, FilterDateRangePopover, type FilterDescriptor, FilterNumberInput, type FilterSelectGroupItem, FilterSelectGroupPopover, FilterSelectInput, FilterTextInput, FlagTag, type FlagTagProps, FormActions, type FormActionsProps, FormSection, type FormSectionProps, Grid, type GridApiQuery, type GridColumn, GridFilters, type GridHandle, type GridProps, type GridState, HtmlInput, type HtmlInputProps, type IconProps, InlineEdit, type InlineEditProps, InputError, InputField, InputLabel, KeyValue, type KeyValueProps, Modal, ModalContent, ModalFooter, type ModalPlacement, type ModalProps, type ModalSize, ModalTitle, MultiSelectInput, type MultiSelectInputProps, type NotificationOptions, NotificationProvider, type NotificationType, NumberInput, type NumberInputProps, PageHeader, type PageHeaderProps, Panel, type PanelProps, Popconfirm, type PopconfirmProps, Pretty, type PrettyProps, RadioGroup, type RadioGroupProps, type RadioOption, SearchInput, type SearchInputProps, SectionHeader, type SectionHeaderProps, SelectInput, type SelectInputProps, ServerError, type ServerErrorValue, Skeleton, type SkeletonProps, SkeletonTable, type SkeletonTableProps, SortDirection, Spinner, type SpinnerColor, type SpinnerProps, StatCard, type StatCardProps, type StatTrendDirection, Stepper, type StepperItem, type StepperProps, SwitchInput, type SwitchInputProps, type TabOption, Table, type TableColumn, type TableProps, type TableSize, Tabs, type TabsProps, type TabsSize, type TabsVariant, Tag, type TagProps, TextInput, type TextInputProps, Textarea, type TextareaProps, Timeline, type TimelineItem, type TimelineProps, Toolbar, type ToolbarProps, Tooltip, type TooltipPlacement, type TooltipProps, type UiColor, type UiDefaultIconType, type UiIconType, type UiSize, type UiThemeConfig, type UploadConfig, UploadInput, type UploadInputProps, type UploadItem, UploadProvider, type UploadStatus, getIcon, initUI, notification, registerIcons, uiTheme, useDrawer, useGrid, useModal, useNotification, useUploadConfig };