@stackone/malachite 0.8.0 → 0.10.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.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import { default as default_2 } from 'react';
4
4
  import { FC } from 'react';
5
5
  import { FieldPath } from 'react-hook-form';
6
6
  import { FieldValues } from 'react-hook-form';
7
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
7
8
  import { ReactNode } from 'react';
8
9
  import { UseFormReturn } from 'react-hook-form';
9
10
 
@@ -447,6 +448,12 @@ declare interface MalachiteContextProps {
447
448
  }
448
449
 
449
450
  export declare interface MalachiteTheme {
451
+ radius: {
452
+ sm: string;
453
+ md: string;
454
+ lg: string;
455
+ xl: string;
456
+ };
450
457
  shadows: {
451
458
  sm: string;
452
459
  md: string;
@@ -599,6 +606,32 @@ export declare interface MalachiteTheme {
599
606
  shadow: string;
600
607
  };
601
608
  };
609
+ table: {
610
+ background: string;
611
+ boxShadow: string;
612
+ header: {
613
+ background: string;
614
+ foreground: string;
615
+ border: string;
616
+ };
617
+ row: {
618
+ background: string;
619
+ foreground: string;
620
+ hoverBackground: string;
621
+ border: string;
622
+ };
623
+ border: string;
624
+ borderedRow: {
625
+ background: string;
626
+ outline: string;
627
+ };
628
+ error: {
629
+ iconBackground: string;
630
+ iconForeground: string;
631
+ titleForeground: string;
632
+ subtitleForeground: string;
633
+ };
634
+ };
602
635
  text: {
603
636
  primary: string;
604
637
  secondary: string;
@@ -644,6 +677,8 @@ declare interface PaddedProps {
644
677
 
645
678
  declare type PaddingSize = 'small' | 'medium' | 'large' | 'none';
646
679
 
680
+ declare type PaddingSize_2 = 'default' | 'compact';
681
+
647
682
  declare interface PageTitleProps {
648
683
  children: default_2.ReactNode;
649
684
  margin?: string;
@@ -652,6 +687,7 @@ declare interface PageTitleProps {
652
687
  }
653
688
 
654
689
  export declare interface PartialMalachiteTheme {
690
+ radius?: Partial<MalachiteTheme['radius']>;
655
691
  shadows?: Partial<MalachiteTheme['shadows']>;
656
692
  colors?: {
657
693
  shadowColor?: string;
@@ -669,6 +705,7 @@ export declare interface PartialMalachiteTheme {
669
705
  buttonList?: Partial<MalachiteTheme['colors']['buttonList']>;
670
706
  pillButton?: Partial<MalachiteTheme['colors']['pillButton']>;
671
707
  tag?: Partial<MalachiteTheme['colors']['tag']>;
708
+ table?: Partial<MalachiteTheme['colors']['table']>;
672
709
  text?: Partial<MalachiteTheme['colors']['text']>;
673
710
  codeBlock?: Partial<MalachiteTheme['colors']['codeBlock']>;
674
711
  };
@@ -755,6 +792,93 @@ declare interface StatisticValueProps {
755
792
  style?: default_2.CSSProperties;
756
793
  }
757
794
 
795
+ export declare const Table: <T extends Record<string, unknown> = Record<string, unknown>>({ columns, data, loading, error, errorTitle, errorSubTitle, bordered, showHeader, rowKey, scrollHeight, size, layout, rowClassName, onRow, rowSelection, pagination, className, style, }: TableProps<T>) => JSX_2.Element;
796
+
797
+ export declare type TableColumnDefinition<T = Record<string, unknown>> = {
798
+ title: string | default_2.ReactNode;
799
+ dataIndex: keyof T;
800
+ key: string;
801
+ width?: string | number;
802
+ ellipsis?: boolean;
803
+ render?: (value: unknown, record?: T, index?: number) => default_2.ReactNode;
804
+ sorter?: boolean | ((a: T, b: T) => number);
805
+ sortIcon?: (props: {
806
+ sortOrder: 'desc' | 'asc' | null;
807
+ }) => default_2.ReactNode;
808
+ onHeaderCell?: (data: T, index?: number) => default_2.HTMLAttributes<HTMLTableCellElement> | default_2.TdHTMLAttributes<HTMLTableCellElement>;
809
+ defaultSortOrder?: 'ascend' | 'descend';
810
+ sortDirections?: ('ascend' | 'descend')[];
811
+ fixed?: 'left' | 'right';
812
+ align?: 'left' | 'center' | 'right';
813
+ };
814
+
815
+ export declare type TableColumns<T = Record<string, unknown>> = TableColumnDefinition<T>[];
816
+
817
+ export declare type TablePaginationPosition = 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
818
+
819
+ declare type TableProps<T = Record<string, unknown>> = {
820
+ columns: TableColumns<T>;
821
+ data: T[];
822
+ loading?: boolean;
823
+ error?: boolean;
824
+ errorTitle?: string;
825
+ errorSubTitle?: string;
826
+ bordered?: boolean;
827
+ showHeader?: boolean;
828
+ rowKey?: string | ((record: T) => string);
829
+ scrollHeight?: string | number;
830
+ type?: TableType;
831
+ size?: TableSize;
832
+ layout?: 'fixed' | 'auto';
833
+ rowClassName?: (record: T, index: number) => string;
834
+ onRow?: (record: T, index: number) => TableRowActions<T>;
835
+ rowSelection?: TableRowSelection<T>;
836
+ pagination?: {
837
+ current?: number;
838
+ pageSize?: number;
839
+ total?: number;
840
+ showSizeChanger?: boolean;
841
+ showQuickJumper?: boolean;
842
+ showTotal?: (total: number, range: [number, number]) => default_2.ReactNode;
843
+ pageSizeOptions?: string[];
844
+ position?: TablePaginationPosition[];
845
+ onChange?: (page: number, pageSize: number) => void;
846
+ onShowSizeChange?: (current: number, size: number) => void;
847
+ };
848
+ className?: string;
849
+ style?: default_2.CSSProperties;
850
+ };
851
+
852
+ declare type TableRowActions<T = Record<string, unknown>> = {
853
+ onClick?: (record: T, index: number) => void;
854
+ onDoubleClick?: (record: T, index: number) => void;
855
+ onContextMenu?: (record: T, index: number) => void;
856
+ onMouseEnter?: (record: T, index: number) => void;
857
+ onMouseLeave?: (record: T, index: number) => void;
858
+ };
859
+
860
+ export declare type TableRowSelection<T = Record<string, unknown>> = {
861
+ type?: 'checkbox' | 'radio';
862
+ selectedRowKeys?: default_2.Key[];
863
+ onChange?: (selectedRowKeys: default_2.Key[], selectedRows: T[]) => void;
864
+ onSelect?: (record: T, selected: boolean, selectedRows: T[], nativeEvent: Event) => void;
865
+ onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
866
+ getCheckboxProps?: (record: T) => {
867
+ disabled?: boolean;
868
+ name?: string;
869
+ };
870
+ hideSelectAll?: boolean;
871
+ preserveSelectedRowKeys?: boolean;
872
+ fixed?: boolean;
873
+ columnWidth?: string | number;
874
+ columnTitle?: string | default_2.ReactNode;
875
+ selections?: boolean | default_2.ReactNode[];
876
+ };
877
+
878
+ export declare type TableSize = 'small' | 'medium' | 'large';
879
+
880
+ export declare type TableType = 'default' | 'compact' | 'bordered';
881
+
758
882
  export declare const Tag: default_2.FC<TagProps>;
759
883
 
760
884
  export declare interface TagProps {
@@ -764,6 +888,7 @@ export declare interface TagProps {
764
888
  shadow?: boolean;
765
889
  textTransform?: 'none' | 'uppercase';
766
890
  width?: WidthSize;
891
+ paddingSize?: PaddingSize_2;
767
892
  icon?: default_2.ReactNode;
768
893
  iconPosition?: 'left' | 'right';
769
894
  pointerType?: 'pointer' | 'default';