@majoo-ui/react 1.44.4 → 1.46.0-rc.1

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
- React
2
-
3
- This library was generated with [Nx](https://nx.dev).
4
-
5
- Running unit tests
6
-
7
- Run `nx test react` to execute the unit tests via [Jest](https://jestjs.io).
1
+ React
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ Running unit tests
6
+
7
+ Run `nx test react` to execute the unit tests via [Jest](https://jestjs.io).
@@ -0,0 +1,143 @@
1
+ import * as React from 'react';
2
+ import type * as Stitches from '@stitches/react';
3
+ import { CSS } from '../../config/stitches.config';
4
+ export declare const ButtonPrimitive: import("@stitches/react/types/styled-component").StyledComponent<"button", {
5
+ buttonType?: "primary" | "secondary" | "ghost" | "negative" | "negative-secondary" | "headerMenu" | "tableMenu" | undefined;
6
+ size?: "sm" | "md" | "lg" | "xs" | undefined;
7
+ iconSize?: "sm" | "md" | "lg" | "xs" | undefined;
8
+ }, {
9
+ sm: "(min-width: 359px)";
10
+ md: "(min-width: 767px)";
11
+ lg: "(min-width: 1023px)";
12
+ xl: "(min-width: 1199px)";
13
+ '2xl': "(min-width: 1399px)";
14
+ '3xl': "(min-width: 1600px)";
15
+ }, import("@stitches/react/types/css-util").CSS<{
16
+ sm: "(min-width: 359px)";
17
+ md: "(min-width: 767px)";
18
+ lg: "(min-width: 1023px)";
19
+ xl: "(min-width: 1199px)";
20
+ '2xl': "(min-width: 1399px)";
21
+ '3xl': "(min-width: 1600px)";
22
+ }, {
23
+ colors: unknown;
24
+ space: unknown;
25
+ shadows: unknown;
26
+ fontSizes: unknown;
27
+ fonts: unknown;
28
+ lineHeights: unknown;
29
+ letterSpacings: unknown;
30
+ radii: unknown;
31
+ sizes: unknown;
32
+ zIndices: unknown;
33
+ }, import("@stitches/react/types/config").DefaultThemeMap, {
34
+ m: (value: {
35
+ readonly [Stitches.$$ScaleValue]: "space";
36
+ }) => {
37
+ margin: {
38
+ readonly [Stitches.$$ScaleValue]: "space";
39
+ };
40
+ };
41
+ mt: (value: {
42
+ readonly [Stitches.$$ScaleValue]: "space";
43
+ }) => {
44
+ marginTop: {
45
+ readonly [Stitches.$$ScaleValue]: "space";
46
+ };
47
+ };
48
+ mr: (value: {
49
+ readonly [Stitches.$$ScaleValue]: "space";
50
+ }) => {
51
+ marginRight: {
52
+ readonly [Stitches.$$ScaleValue]: "space";
53
+ };
54
+ };
55
+ mb: (value: {
56
+ readonly [Stitches.$$ScaleValue]: "space";
57
+ }) => {
58
+ marginBottom: {
59
+ readonly [Stitches.$$ScaleValue]: "space";
60
+ };
61
+ };
62
+ ml: (value: {
63
+ readonly [Stitches.$$ScaleValue]: "space";
64
+ }) => {
65
+ marginLeft: {
66
+ readonly [Stitches.$$ScaleValue]: "space";
67
+ };
68
+ };
69
+ mx: (value: {
70
+ readonly [Stitches.$$ScaleValue]: "space";
71
+ }) => {
72
+ marginLeft: {
73
+ readonly [Stitches.$$ScaleValue]: "space";
74
+ };
75
+ marginRight: {
76
+ readonly [Stitches.$$ScaleValue]: "space";
77
+ };
78
+ };
79
+ my: (value: {
80
+ readonly [Stitches.$$ScaleValue]: "space";
81
+ }) => {
82
+ marginTop: {
83
+ readonly [Stitches.$$ScaleValue]: "space";
84
+ };
85
+ marginBottom: {
86
+ readonly [Stitches.$$ScaleValue]: "space";
87
+ };
88
+ };
89
+ size: (value: {
90
+ readonly [Stitches.$$PropertyValue]: "width";
91
+ }) => {
92
+ width: {
93
+ readonly [Stitches.$$PropertyValue]: "width";
94
+ };
95
+ height: {
96
+ readonly [Stitches.$$PropertyValue]: "width";
97
+ };
98
+ };
99
+ subtleColor: (value: string) => {
100
+ color: string;
101
+ backgroundColor: string;
102
+ };
103
+ }>>;
104
+ interface AdditionalButtonProps extends React.ComponentPropsWithoutRef<'button'> {
105
+ /**
106
+ * Specify whether the button should be disabled, or not
107
+ */
108
+ disabled?: boolean;
109
+ /**
110
+ * Specify whether the button should be displayed as block and 100% width , or not
111
+ */
112
+ block?: boolean;
113
+ /**
114
+ * Specify the button width
115
+ */
116
+ width?: string | number;
117
+ /**
118
+ * Specify the button left icon component
119
+ */
120
+ leftIcon?: React.ReactNode;
121
+ /**
122
+ * Specify the button right icon component
123
+ */
124
+ rightIcon?: React.ReactNode;
125
+ /**
126
+ * Specify whether the Button children is icon only , or not
127
+ */
128
+ icon?: boolean;
129
+ css?: CSS;
130
+ }
131
+ export declare const Button: React.ForwardRefExoticComponent<import("@stitches/react/types/styled-component").TransformProps<{
132
+ buttonType?: "primary" | "secondary" | "ghost" | "negative" | "negative-secondary" | "headerMenu" | "tableMenu" | undefined;
133
+ size?: "sm" | "md" | "lg" | "xs" | undefined;
134
+ iconSize?: "sm" | "md" | "lg" | "xs" | undefined;
135
+ }, {
136
+ sm: "(min-width: 359px)";
137
+ md: "(min-width: 767px)";
138
+ lg: "(min-width: 1023px)";
139
+ xl: "(min-width: 1199px)";
140
+ '2xl': "(min-width: 1399px)";
141
+ '3xl': "(min-width: 1600px)";
142
+ }> & AdditionalButtonProps & React.RefAttributes<HTMLButtonElement>>;
143
+ export default Button;
@@ -0,0 +1,2 @@
1
+ export { default as Button } from './Button';
2
+ export * from './Button';
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ import { CSS } from '../../../../config/stitches.config';
3
+ interface InputComboboxProps extends Partial<Omit<React.ComponentPropsWithoutRef<'input'>, 'size'>> {
4
+ /**
5
+ * Array of options.
6
+ */
7
+ options: string[];
8
+ /**
9
+ * If true, the search icon is shown.
10
+ */
11
+ showLeadingIcon?: boolean;
12
+ /**
13
+ * Specify the default value.
14
+ */
15
+ defaultValue?: string;
16
+ /**
17
+ * If true, the component is disabled.
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * Specify the input placeholder.
22
+ */
23
+ placeholder?: string;
24
+ /**
25
+ * Specify the options view placement.
26
+ */
27
+ placement?: 'top' | 'bottom';
28
+ /**
29
+ * Specify the input size.
30
+ */
31
+ size?: 'sm' | 'lg';
32
+ /**
33
+ * If true, the input will become invalid state.
34
+ */
35
+ isInvalid?: boolean;
36
+ /**
37
+ * Called whenever the input value changes.
38
+ */
39
+ onValueChange?: (value: string) => void;
40
+ css?: CSS;
41
+ }
42
+ export declare const InputCombobox: React.ForwardRefExoticComponent<InputComboboxProps & React.RefAttributes<HTMLInputElement>>;
43
+ export {};
@@ -0,0 +1 @@
1
+ export * from './InputCombobox';
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ declare type Option = {
3
+ label: string;
4
+ value: string;
5
+ };
6
+ interface InputComboboxProps {
7
+ options: any[];
8
+ placeholder?: string;
9
+ onChange?: (value: string, option: Option) => void;
10
+ disabled?: boolean;
11
+ readOnly?: boolean;
12
+ showSearch?: boolean;
13
+ allowClear?: boolean;
14
+ isInvalid?: boolean;
15
+ size?: 'sm' | 'lg';
16
+ }
17
+ declare const InputSelect: React.FC<InputComboboxProps>;
18
+ export default InputSelect;
@@ -14,6 +14,9 @@ export { default as InputTags } from './InputTags/InputTags';
14
14
  export { default as InputSwitch } from './InputSwitch/InputSwitch';
15
15
  export { default as InputSearchbox } from './InputSearchbox/InputSearchbox';
16
16
  export { default as InputSelect } from './InputSelect/InputSelect';
17
+ export * from './InputSelect';
18
+ export { default as InputSelectCheck } from './InputSelectCheck/InputSelectCheck';
17
19
  export { default as InputSelectTag } from './InputSelectTag/InputSelectTag';
18
20
  export { default as InputCreatable } from './InputCreatable/InputCreatable';
19
21
  export { default as InputResourceList } from './InputResourceList/InputResourceList';
22
+ export * from './InputCombobox';
@@ -40,3 +40,4 @@ export * from './tableOfContent';
40
40
  export * from './editableTable';
41
41
  export * from './loadingBar';
42
42
  export * from './progressIndicator';
43
+ export * from './link';
@@ -0,0 +1,108 @@
1
+ import * as React from 'react';
2
+ import type * as Stitches from '@stitches/react';
3
+ import { CSS } from '../../config/stitches.config';
4
+ declare const StyledLink: import("@stitches/react/types/styled-component").StyledComponent<"a", {
5
+ color?: "success" | "info" | "warning" | "failed" | undefined;
6
+ }, {
7
+ sm: "(min-width: 359px)";
8
+ md: "(min-width: 767px)";
9
+ lg: "(min-width: 1023px)";
10
+ xl: "(min-width: 1199px)";
11
+ '2xl': "(min-width: 1399px)";
12
+ '3xl': "(min-width: 1600px)";
13
+ }, import("@stitches/react/types/css-util").CSS<{
14
+ sm: "(min-width: 359px)";
15
+ md: "(min-width: 767px)";
16
+ lg: "(min-width: 1023px)";
17
+ xl: "(min-width: 1199px)";
18
+ '2xl': "(min-width: 1399px)";
19
+ '3xl': "(min-width: 1600px)";
20
+ }, {
21
+ colors: unknown;
22
+ space: unknown;
23
+ shadows: unknown;
24
+ fontSizes: unknown;
25
+ fonts: unknown;
26
+ lineHeights: unknown;
27
+ letterSpacings: unknown;
28
+ radii: unknown;
29
+ sizes: unknown;
30
+ zIndices: unknown;
31
+ }, import("@stitches/react/types/config").DefaultThemeMap, {
32
+ m: (value: {
33
+ readonly [Stitches.$$ScaleValue]: "space";
34
+ }) => {
35
+ margin: {
36
+ readonly [Stitches.$$ScaleValue]: "space";
37
+ };
38
+ };
39
+ mt: (value: {
40
+ readonly [Stitches.$$ScaleValue]: "space";
41
+ }) => {
42
+ marginTop: {
43
+ readonly [Stitches.$$ScaleValue]: "space";
44
+ };
45
+ };
46
+ mr: (value: {
47
+ readonly [Stitches.$$ScaleValue]: "space";
48
+ }) => {
49
+ marginRight: {
50
+ readonly [Stitches.$$ScaleValue]: "space";
51
+ };
52
+ };
53
+ mb: (value: {
54
+ readonly [Stitches.$$ScaleValue]: "space";
55
+ }) => {
56
+ marginBottom: {
57
+ readonly [Stitches.$$ScaleValue]: "space";
58
+ };
59
+ };
60
+ ml: (value: {
61
+ readonly [Stitches.$$ScaleValue]: "space";
62
+ }) => {
63
+ marginLeft: {
64
+ readonly [Stitches.$$ScaleValue]: "space";
65
+ };
66
+ };
67
+ mx: (value: {
68
+ readonly [Stitches.$$ScaleValue]: "space";
69
+ }) => {
70
+ marginLeft: {
71
+ readonly [Stitches.$$ScaleValue]: "space";
72
+ };
73
+ marginRight: {
74
+ readonly [Stitches.$$ScaleValue]: "space";
75
+ };
76
+ };
77
+ my: (value: {
78
+ readonly [Stitches.$$ScaleValue]: "space";
79
+ }) => {
80
+ marginTop: {
81
+ readonly [Stitches.$$ScaleValue]: "space";
82
+ };
83
+ marginBottom: {
84
+ readonly [Stitches.$$ScaleValue]: "space";
85
+ };
86
+ };
87
+ size: (value: {
88
+ readonly [Stitches.$$PropertyValue]: "width";
89
+ }) => {
90
+ width: {
91
+ readonly [Stitches.$$PropertyValue]: "width";
92
+ };
93
+ height: {
94
+ readonly [Stitches.$$PropertyValue]: "width";
95
+ };
96
+ };
97
+ subtleColor: (value: string) => {
98
+ color: string;
99
+ backgroundColor: string;
100
+ };
101
+ }>>;
102
+ declare type LinkVariants = Stitches.VariantProps<typeof StyledLink> & React.ComponentPropsWithoutRef<'a'>;
103
+ interface ButtonLinkProps extends LinkVariants {
104
+ isExternal: boolean;
105
+ css?: CSS;
106
+ }
107
+ export declare const Link: React.ForwardRefExoticComponent<ButtonLinkProps & React.RefAttributes<HTMLAnchorElement>>;
108
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Link';
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import type * as Stitches from '@stitches/react';
3
3
  interface LoadingBarProps {
4
4
  progress: number;
@@ -7,6 +7,7 @@ interface LoadingBarProps {
7
7
  showProgressOnly?: boolean;
8
8
  show?: boolean;
9
9
  isAuto?: boolean;
10
+ onCompleted?: React.ChangeEventHandler;
10
11
  }
11
12
  export default function LoadingBar(props: LoadingBarProps): JSX.Element;
12
13
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import { Column } from 'react-table';
1
+ import * as React from 'react';
2
+ import { CellProps } from 'react-table';
3
3
  import { CSS } from '../../config/stitches.config';
4
4
  export declare const TableContent: import("@stitches/react/types/styled-component").StyledComponent<"table", {}, {
5
5
  sm: "(min-width: 359px)";
@@ -877,35 +877,84 @@ export declare const addOnCellStyle: (id: any) => {
877
877
  } | {
878
878
  style?: undefined;
879
879
  };
880
- export declare const defaultFetchDataParams: {
881
- pageIndex: number;
882
- pageSize: number;
883
- };
880
+ export declare const defaultFetchDataParams: FetchDataParams;
884
881
  interface FetchDataParams {
885
882
  pageIndex?: number;
886
883
  pageSize?: number;
887
884
  sortAccessor?: string;
888
885
  sortDirection?: string;
889
886
  }
890
- interface TableProps {
887
+ export interface TableProps {
888
+ /**
889
+ * The data array that you want to display on the table.
890
+ */
891
891
  data: any[];
892
- columns: Column<any>[];
893
- keyId: string;
894
- pageIndex: number;
895
- totalData: number;
892
+ /**
893
+ * The core columns configuration object for the entire table.
894
+ */
895
+ columns: any[];
896
+ /**
897
+ * Row's unique key (for selectedIds & onSelectedChange purpose).
898
+ */
899
+ keyId?: string;
900
+ /**
901
+ * The index of the page that should be displayed.
902
+ */
903
+ pageIndex?: number;
904
+ /**
905
+ * Total amount of the data.
906
+ */
907
+ totalData?: number;
908
+ /**
909
+ * Function executed when pagination or sorter is changed.
910
+ * interface FetchDataParams { <br/>
911
+ * &nbsp;&nbsp;&nbsp;&nbsp;pageIndex?: number;<br/>
912
+ * &nbsp;&nbsp;&nbsp;&nbsp;pageSize?: number;<br/>
913
+ * &nbsp;&nbsp;&nbsp;&nbsp;sortAccessor?: string;<br/>
914
+ * &nbsp;&nbsp;&nbsp;&nbsp;sortDirection?: string;<br/>
915
+ * }
916
+ */
896
917
  fetchData?: (params: FetchDataParams) => void;
897
- isLoading: boolean;
918
+ /**
919
+ * Loading status of table.
920
+ */
921
+ isLoading?: boolean;
898
922
  css?: CSS;
923
+ /**
924
+ * Table header css styling.
925
+ */
899
926
  headerCss?: CSS;
927
+ /**
928
+ * Callback fired when the selected rows are updated.
929
+ */
900
930
  onSelectedChange?: (selectedIds: string[]) => void;
901
- hideDataInfo: boolean;
931
+ /**
932
+ * If true, the left-side footer component is hidden.
933
+ */
934
+ hideDataInfo?: boolean;
935
+ /**
936
+ * Table empty data message.
937
+ */
902
938
  emptyDataMessage?: string;
903
- isInfiniteScroll: boolean;
904
- hasMoreItems: boolean;
905
- rowLimit: number;
906
- cellAlign: 'top' | 'center' | 'bottom';
907
939
  /**
908
- * Example:
940
+ * If true, the table pagination will become an infinite scroll.
941
+ */
942
+ isInfiniteScroll?: boolean;
943
+ /**
944
+ * Determine whether more data can be loaded.
945
+ */
946
+ hasMoreItems?: boolean;
947
+ /**
948
+ * Determines the amount of rows on any given page.
949
+ */
950
+ rowLimit?: number;
951
+ /**
952
+ * Specify the table cell align position.
953
+ */
954
+ cellAlign?: 'top' | 'center' | 'bottom';
955
+ /**
956
+ * Selected data id (based on the keyId prop).
957
+ * Example:<br/>
909
958
  * {
910
959
  * '8192389219289': true,
911
960
  * '2130912039281': true,
@@ -914,8 +963,65 @@ interface TableProps {
914
963
  */
915
964
  selectedIds?: Record<string, boolean>;
916
965
  }
917
- declare function Table({ columns, data, keyId, pageIndex: controlledPageIndex, totalData, fetchData, hideDataInfo, emptyDataMessage, isLoading, css, headerCss, onSelectedChange, isInfiniteScroll, hasMoreItems, rowLimit, cellAlign, selectedIds, }: TableProps): JSX.Element;
918
- declare namespace Table {
919
- var displayName: string;
966
+ export declare function Table({ columns, data, keyId, pageIndex: controlledPageIndex, totalData, fetchData, hideDataInfo, emptyDataMessage, isLoading, css, headerCss, onSelectedChange, isInfiniteScroll, hasMoreItems, rowLimit, cellAlign, selectedIds, }: TableProps): JSX.Element;
967
+ export interface TableColumnProps {
968
+ /**
969
+ * Required if accessor is a function<br/>
970
+ * This is the unique ID for the column. It is used by reference in things like sorting, grouping, filtering etc.
971
+ * If a string accessor is used, it defaults as the column ID, but can be overridden if necessary.
972
+ */
973
+ id: string;
974
+ /**
975
+ * Column header name
976
+ */
977
+ Header?: string | (() => string | null) | null;
978
+ /**
979
+ * This string/function is used to build the data model for your column.
980
+ * The data returned by an accessor should be primitive and sortable.
981
+ */
982
+ accessor: string | ((originalRow: any, rowIndex: any) => any);
983
+ /**
984
+ * This function (or component) is primarily used for formatting the column value,<br/>
985
+ * eg. If your column accessor returns a date object, you can use a Cell function to format that date to a readable format.
986
+ */
987
+ Cell: (props: CellProps<any>) => React.ReactNode;
988
+ /**
989
+ * Required if responsive mobile layout is needed.<br/>
990
+ * If true, the column will become main column on mobile layout.
991
+ */
992
+ isMobileHeader: boolean;
993
+ /**
994
+ * If true, the column will be rendered on the expanded row.
995
+ */
996
+ isSubRow?: boolean;
997
+ /**
998
+ * If false, the column will be sortable.
999
+ */
1000
+ unsortable?: boolean;
1001
+ /**
1002
+ * Specifies the width for the column.
1003
+ */
1004
+ colWidth?: number;
1005
+ /**
1006
+ * Specifies the maximum width for the column.
1007
+ */
1008
+ colMaxWidth?: number;
1009
+ /**
1010
+ * Specifies the minimum width for the column.
1011
+ */
1012
+ colMinWidth?: number;
1013
+ /**
1014
+ * Specifies the sticky column order position.
1015
+ */
1016
+ sticky?: 'left' | 'right';
1017
+ /**
1018
+ * Specifies the sticky column absolute position.
1019
+ */
1020
+ stickyPosition?: number;
1021
+ /**
1022
+ * If true, the column will be rendered on the bottom flex of mobile layout.
1023
+ */
1024
+ isAction?: boolean;
920
1025
  }
921
- export default Table;
1026
+ export declare const TableColumn: React.FC<TableColumnProps>;
1027
+ export {};
@@ -1,4 +1,3 @@
1
- export { default as Table } from './Table';
2
1
  export * from './Table';
3
2
  export * from './components';
4
3
  export { default as MobileTable } from './MobileTable';
@@ -0,0 +1,9 @@
1
+ export interface ITransform<T> {
2
+ name: string;
3
+ value: any;
4
+ rec: T;
5
+ key: any;
6
+ isDisabled: boolean;
7
+ }
8
+ declare function useListOption<T>(list: T[], nameKey?: string | string[], valueKey?: string | string[], disableList?: string[], separator?: string | ((values: string | string[], item: any, index: any) => string)): ITransform<T>[];
9
+ export default useListOption;