qucoon-components 0.0.3 → 0.0.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.
@@ -0,0 +1,16 @@
1
+ import { FormikValues } from 'formik';
2
+ import { Formik } from '../../../utilities/types';
3
+ import { HTMLAttributes } from 'react';
4
+ type EnterAddressFormProps<T extends FormikValues> = {
5
+ formik: Formik<T>;
6
+ countryInputName: string;
7
+ stateInputName: string;
8
+ cityInputName?: string;
9
+ localGovernmentInputName?: string;
10
+ streetAddressInputName?: string;
11
+ postalCodeInputName?: string;
12
+ manuallyInputCity?: boolean;
13
+ requiredFields?: string[];
14
+ } & React.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
15
+ declare const EnterAddressForm: <T extends FormikValues>({ formik, countryInputName, stateInputName, cityInputName, localGovernmentInputName, streetAddressInputName, postalCodeInputName, manuallyInputCity, requiredFields, }: EnterAddressFormProps<T>) => import("react/jsx-runtime").JSX.Element;
16
+ export default EnterAddressForm;
@@ -1,4 +1,6 @@
1
1
  /**
2
2
  * Auto-generated barrel for src/components/ui/form
3
3
  */
4
+ export { default as EnterAddressForm } from './EnterAddressForm';
5
+ export * from './EnterAddressForm';
4
6
  export * from './dashboard';
@@ -1,91 +1,8 @@
1
- import { ColDef, GridOptions } from 'ag-grid-community';
1
+ import { GridOptions } from 'ag-grid-community';
2
2
  import { CSSProperties } from 'react';
3
3
  import { DeleteActionRendererProps, EditActionRendererProps, HeaderControlsProps } from '../..';
4
4
  import { ViewActionRendererProps } from './renderers/ViewActionRenderer';
5
- export type ColumnType = Omit<ColDef, "field"> & {
6
- field: string;
7
- style?: React.CSSProperties;
8
- onClick?: (data: any) => void;
9
- path?: string;
10
- isCurrency?: boolean;
11
- isDate?: boolean;
12
- statusIndicator?: "fail" | "success" | "normal";
13
- sortable?: boolean;
14
- filterable?: boolean;
15
- filterType?: 'text' | 'number' | 'date' | 'select' | 'boolean';
16
- filterOptions?: {
17
- label: string;
18
- value: any;
19
- }[];
20
- filterPlaceholder?: string;
21
- };
22
- export type ServerSideParams = {
23
- pageNumber: number;
24
- pageSize: number;
25
- search?: string;
26
- sortBy?: string;
27
- sortDir?: 'ASC' | 'DESC';
28
- filters?: Record<string, any>;
29
- dateFilters?: Record<string, {
30
- from?: string;
31
- to?: string;
32
- }>;
33
- };
34
- export type FilterState = {
35
- searchText: string;
36
- columnFilters: Record<string, any>;
37
- dateFilters: Record<string, {
38
- from?: string;
39
- to?: string;
40
- }>;
41
- sort: {
42
- field: string;
43
- direction: "ASC" | "DESC";
44
- };
45
- };
46
- export type FilterActions = {
47
- setSearchText: (text: string) => void;
48
- setColumnFilter: (field: string, value: any) => void;
49
- setDateFilter: (field: string, range: {
50
- from?: string;
51
- to?: string;
52
- }) => void;
53
- setSort: (field: string, direction: "ASC" | "DESC") => void;
54
- resetFilters: () => void;
55
- applyFilters: () => void;
56
- };
57
- export type FilterPanelProps = FilterState & FilterActions & {
58
- availableFields: Array<{
59
- field: string;
60
- label: string;
61
- type: 'text' | 'select' | 'date';
62
- options?: string[];
63
- }>;
64
- onClose?: () => void;
65
- showGlobalSearch?: boolean;
66
- showColumnFilters?: boolean;
67
- showSortingControls?: boolean;
68
- };
69
- export type ServerSideOperations = "refresh" | "search" | "filter" | "sort" | "pagination";
70
- export type ServerSideOperationsConfig = Partial<Record<ServerSideOperations, {
71
- fetchRows?: (params: ServerSideParams) => Promise<DataGridRows>;
72
- onFetchRowsSuccess?: (response: DataGridRows) => void;
73
- onFetchRowsError?: (error: unknown) => void;
74
- }>>;
75
- export type DataGridRows<T = any> = {
76
- data: T[];
77
- pageNumber?: number;
78
- pageSize?: number;
79
- totalPages?: number;
80
- totalRecords?: number;
81
- };
82
- export type DefaultPaginationConfig = {
83
- isPageZeroIndexed?: boolean;
84
- pageNumber?: number;
85
- pageSize?: number;
86
- totalRecords?: number;
87
- totalPages?: number;
88
- };
5
+ import { ColumnType, DataGridCustomization, DataGridRows, DefaultPaginationConfig, FilterPanelProps, ServerSideOperationsConfig, ServerSideParams } from './types';
89
6
  export type BaseDataGridProps = {
90
7
  title?: string;
91
8
  uniqueRowId: string;
@@ -112,12 +29,17 @@ export type BaseDataGridProps = {
112
29
  optionName: string;
113
30
  onClick: (data: any) => void;
114
31
  optionStyle?: CSSProperties;
115
- }[];
32
+ }[] | ((rowData: any) => {
33
+ optionName: string;
34
+ onClick: (data: any) => void;
35
+ optionStyle?: CSSProperties;
36
+ }[]);
116
37
  renderFilterPanel?: React.FC<FilterPanelProps>;
117
38
  availableFilterFields?: FilterPanelProps["availableFields"];
118
39
  defaultHeaderProps?: HeaderControlsProps;
119
40
  defaultFilterPanelProps?: FilterPanelProps;
120
41
  gridOptions?: GridOptions;
42
+ customization?: DataGridCustomization;
121
43
  };
122
44
  declare const BaseDataGrid: import('react').MemoExoticComponent<(props: BaseDataGridProps) => import("react/jsx-runtime").JSX.Element>;
123
45
  export default BaseDataGrid;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Auto-generated barrel for src/components/ui/table/hooks
3
+ */
4
+ export { default as useCellCopy } from './useCellCopy';
5
+ export * from './useCellCopy';
6
+ export { default as useDataGridDynamicStyles } from './useDataGridDynamicStyles';
7
+ export * from './useDataGridDynamicStyles';
8
+ export { default as useDataGridTheme } from './useDataGridTheme';
9
+ export * from './useDataGridTheme';
@@ -0,0 +1,6 @@
1
+ import { AgGridReact } from 'ag-grid-react';
2
+ export declare const useCellCopy: (gridRef: React.RefObject<AgGridReact>) => {
3
+ copySelectedCells: () => void;
4
+ copySelectedRows: () => void;
5
+ };
6
+ export default useCellCopy;
@@ -0,0 +1,3 @@
1
+ import { DataGridTheme } from '../types';
2
+ declare const useDataGridDynamicStyles: (theme: DataGridTheme) => Record<string, string>;
3
+ export default useDataGridDynamicStyles;
@@ -0,0 +1,3 @@
1
+ import { DataGridTheme } from '../types';
2
+ export declare const useDataGridTheme: (customTheme?: DataGridTheme) => DataGridTheme;
3
+ export default useDataGridTheme;
@@ -8,5 +8,7 @@ export * from './BaseTable';
8
8
  export { default as Table } from './Table';
9
9
  export * from './Table';
10
10
  export * from './components';
11
+ export * from './hooks';
11
12
  export * from './renderers';
12
13
  export * from './tablePanels';
14
+ export * from './types';
@@ -0,0 +1,3 @@
1
+ import { FilterPanelProps } from '../types';
2
+ declare const DefaultFilterPanel: React.FC<FilterPanelProps>;
3
+ export default DefaultFilterPanel;
@@ -5,3 +5,5 @@ export { default as BaseTableHeaderControls } from './BaseTableHeaderControls';
5
5
  export * from './BaseTableHeaderControls';
6
6
  export { default as BaseTablePaginationPanel } from './BaseTablePaginationPanel';
7
7
  export * from './BaseTablePaginationPanel';
8
+ export { default as DefaultFilterPanel } from './DefaultFilterPanel';
9
+ export * from './DefaultFilterPanel';
@@ -0,0 +1,167 @@
1
+ import { ColDef, GridOptions, SelectionChangedEvent } from 'ag-grid-community';
2
+ import { CSSProperties } from 'react';
3
+ import { HeaderControlsProps } from '../../..';
4
+ export type ColumnType = Omit<ColDef, "field"> & {
5
+ field: string;
6
+ style?: React.CSSProperties;
7
+ onClick?: (data: any) => void;
8
+ path?: string;
9
+ isCurrency?: boolean;
10
+ isDate?: boolean;
11
+ statusIndicator?: "fail" | "success" | "normal";
12
+ sortable?: boolean;
13
+ filterable?: boolean;
14
+ filterType?: 'text' | 'number' | 'date' | 'select' | 'boolean';
15
+ filterOptions?: {
16
+ label: string;
17
+ value: any;
18
+ }[];
19
+ filterPlaceholder?: string;
20
+ };
21
+ export interface DataGridTheme {
22
+ container?: {
23
+ className?: string;
24
+ style?: CSSProperties;
25
+ borderRadius?: string;
26
+ backgroundColor?: string;
27
+ boxShadow?: string;
28
+ };
29
+ table?: {
30
+ className?: string;
31
+ style?: CSSProperties;
32
+ agThemeClass?: string;
33
+ customCssVariables?: Record<string, string>;
34
+ };
35
+ header?: {
36
+ className?: string;
37
+ style?: CSSProperties;
38
+ backgroundColor?: string;
39
+ fontWeight?: string | number;
40
+ fontSize?: string;
41
+ color?: string;
42
+ };
43
+ row?: {
44
+ className?: string;
45
+ style?: CSSProperties;
46
+ alternateRowBackgroundColor?: string;
47
+ hoverColor?: string;
48
+ selectedColor?: string;
49
+ borderColor?: string;
50
+ };
51
+ pagination?: {
52
+ className?: string;
53
+ style?: CSSProperties;
54
+ };
55
+ filterPanel?: {
56
+ className?: string;
57
+ style?: CSSProperties;
58
+ backgroundColor?: string;
59
+ borderRadius?: string;
60
+ boxShadow?: string;
61
+ };
62
+ }
63
+ export interface DataGridLayout {
64
+ containerHeight?: string | number;
65
+ containerMinHeight?: string | number;
66
+ containerMaxHeight?: string | number;
67
+ rowHeight?: number;
68
+ headerHeight?: number;
69
+ domLayout?: 'normal' | 'autoHeight' | 'print';
70
+ pagination?: {
71
+ pageSize?: number;
72
+ pageSizeSelector?: number[] | false;
73
+ suppressPaginationPanel?: boolean;
74
+ };
75
+ }
76
+ export interface DataGridCustomization {
77
+ theme?: DataGridTheme;
78
+ layout?: DataGridLayout;
79
+ defaultColDef?: Partial<ColDef>;
80
+ gridOptions?: Partial<GridOptions>;
81
+ containerStyle?: CSSProperties;
82
+ className?: string;
83
+ components?: {
84
+ header?: React.FC<HeaderControlsProps>;
85
+ filterPanel?: React.FC<FilterPanelProps>;
86
+ emptyState?: React.FC<any>;
87
+ loadingOverlay?: React.FC<any>;
88
+ pagination?: React.FC<any>;
89
+ cellRenderers?: Record<string, React.FC<any>>;
90
+ };
91
+ callbacks?: {
92
+ onRowClick?: (event: any) => void;
93
+ onRowDoubleClick?: (event: any) => void;
94
+ onCellClick?: (event: any) => void;
95
+ onSelectionChanged?: (event: SelectionChangedEvent) => void;
96
+ onColumnResized?: (event: any) => void;
97
+ onSortChanged?: (event: any) => void;
98
+ onFilterChanged?: (event: any) => void;
99
+ };
100
+ }
101
+ export type ServerSideParams = {
102
+ pageNumber: number;
103
+ pageSize: number;
104
+ search?: string;
105
+ sortBy?: string;
106
+ sortDir?: 'ASC' | 'DESC';
107
+ filters?: Record<string, any>;
108
+ dateFilters?: Record<string, {
109
+ from?: string;
110
+ to?: string;
111
+ }>;
112
+ };
113
+ export type FilterState = {
114
+ searchText: string;
115
+ columnFilters: Record<string, any>;
116
+ dateFilters: Record<string, {
117
+ from?: string;
118
+ to?: string;
119
+ }>;
120
+ sort: {
121
+ field: string;
122
+ direction: "ASC" | "DESC";
123
+ };
124
+ };
125
+ export type FilterActions = {
126
+ setSearchText: (text: string) => void;
127
+ setColumnFilter: (field: string, value: any) => void;
128
+ setDateFilter: (field: string, range: {
129
+ from?: string;
130
+ to?: string;
131
+ }) => void;
132
+ setSort: (field: string, direction: "ASC" | "DESC") => void;
133
+ resetFilters: () => void;
134
+ applyFilters: () => void;
135
+ };
136
+ export type FilterPanelProps = FilterState & FilterActions & {
137
+ availableFields: Array<{
138
+ field: string;
139
+ label: string;
140
+ type: 'text' | 'select' | 'date';
141
+ options?: string[];
142
+ }>;
143
+ onClose?: () => void;
144
+ showGlobalSearch?: boolean;
145
+ showColumnFilters?: boolean;
146
+ showSortingControls?: boolean;
147
+ };
148
+ export type ServerSideOperations = "refresh" | "search" | "filter" | "sort" | "pagination";
149
+ export type ServerSideOperationsConfig = Partial<Record<ServerSideOperations, {
150
+ fetchRows?: (params: ServerSideParams) => Promise<DataGridRows>;
151
+ onFetchRowsSuccess?: (response: DataGridRows) => void;
152
+ onFetchRowsError?: (error: unknown) => void;
153
+ }>>;
154
+ export type DataGridRows<T = any> = {
155
+ data: T[];
156
+ pageNumber?: number;
157
+ pageSize?: number;
158
+ totalPages?: number;
159
+ totalRecords?: number;
160
+ };
161
+ export type DefaultPaginationConfig = {
162
+ isPageZeroIndexed?: boolean;
163
+ pageNumber?: number;
164
+ pageSize?: number;
165
+ totalRecords?: number;
166
+ totalPages?: number;
167
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qucoon-components",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",