@true-tech-team/react-components 0.0.5 → 0.0.7
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/index.css +1 -1
- package/index.js +1 -1
- package/index.mjs +14032 -8735
- package/lib/components/display/List/List.d.ts +6 -0
- package/lib/components/display/List/ListContext.d.ts +15 -0
- package/lib/components/display/List/ListEmpty.d.ts +25 -0
- package/lib/components/display/List/ListGroup.d.ts +36 -0
- package/lib/components/display/List/ListHeader.d.ts +62 -0
- package/lib/components/display/List/ListItem.d.ts +19 -0
- package/lib/components/display/List/ListSearch.d.ts +32 -0
- package/lib/components/display/List/ListSkeleton.d.ts +27 -0
- package/lib/components/display/List/hooks/index.d.ts +5 -0
- package/lib/components/display/List/hooks/useListExpand.d.ts +6 -0
- package/lib/components/display/List/hooks/useListFilter.d.ts +6 -0
- package/lib/components/display/List/hooks/useListGroups.d.ts +6 -0
- package/lib/components/display/List/hooks/useListKeyboardNav.d.ts +6 -0
- package/lib/components/display/List/hooks/useListSelection.d.ts +6 -0
- package/lib/components/display/List/index.d.ts +11 -0
- package/lib/components/display/List/types.d.ts +485 -0
- package/lib/components/display/List/utils.d.ts +47 -0
- package/lib/components/display/Table/Table.d.ts +6 -0
- package/lib/components/display/Table/TableBody.d.ts +4 -0
- package/lib/components/display/Table/TableCell.d.ts +12 -0
- package/lib/components/display/Table/TableContext.d.ts +10 -0
- package/lib/components/display/Table/TableHeader.d.ts +4 -0
- package/lib/components/display/Table/TableRow.d.ts +9 -0
- package/lib/components/display/Table/TableSearch.d.ts +32 -0
- package/lib/components/display/Table/TableSkeleton.d.ts +12 -0
- package/lib/components/display/Table/hooks/index.d.ts +10 -0
- package/lib/components/display/Table/hooks/useInfiniteScroll.d.ts +11 -0
- package/lib/components/display/Table/hooks/useTableExpand.d.ts +10 -0
- package/lib/components/display/Table/hooks/useTableFilter.d.ts +22 -0
- package/lib/components/display/Table/hooks/useTableSelection.d.ts +16 -0
- package/lib/components/display/Table/hooks/useTableSort.d.ts +11 -0
- package/lib/components/display/Table/index.d.ts +13 -0
- package/lib/components/display/Table/types.d.ts +295 -0
- package/lib/components/display/Table/utils.d.ts +37 -0
- package/lib/components/display/index.d.ts +1 -0
- package/lib/components/dnd/DndProvider/DndContext.d.ts +91 -0
- package/lib/components/dnd/DndProvider/DndProvider.d.ts +37 -0
- package/lib/components/dnd/DndProvider/index.d.ts +3 -0
- package/lib/components/dnd/DragHandle/DragHandle.d.ts +41 -0
- package/lib/components/dnd/DragHandle/index.d.ts +2 -0
- package/lib/components/dnd/DragOverlay/DragOverlay.d.ts +39 -0
- package/lib/components/dnd/DragOverlay/index.d.ts +2 -0
- package/lib/components/dnd/KanbanBoard/KanbanBoard.d.ts +126 -0
- package/lib/components/dnd/KanbanBoard/KanbanBoardContext.d.ts +62 -0
- package/lib/components/dnd/KanbanBoard/KanbanCard.d.ts +76 -0
- package/lib/components/dnd/KanbanBoard/KanbanColumn.d.ts +43 -0
- package/lib/components/dnd/KanbanBoard/index.d.ts +5 -0
- package/lib/components/dnd/ResizablePanels/ResizablePanel.d.ts +53 -0
- package/lib/components/dnd/ResizablePanels/ResizablePanels.d.ts +43 -0
- package/lib/components/dnd/ResizablePanels/ResizablePanelsContext.d.ts +64 -0
- package/lib/components/dnd/ResizablePanels/ResizeHandle.d.ts +28 -0
- package/lib/components/dnd/ResizablePanels/index.d.ts +5 -0
- package/lib/components/dnd/SortableGrid/SortableGrid.d.ts +76 -0
- package/lib/components/dnd/SortableGrid/SortableGridItem.d.ts +47 -0
- package/lib/components/dnd/SortableGrid/index.d.ts +3 -0
- package/lib/components/dnd/SortableList/SortableItem.d.ts +76 -0
- package/lib/components/dnd/SortableList/SortableList.d.ts +98 -0
- package/lib/components/dnd/SortableList/SortableListContext.d.ts +42 -0
- package/lib/components/dnd/SortableList/index.d.ts +4 -0
- package/lib/components/dnd/hooks/index.d.ts +3 -0
- package/lib/components/dnd/hooks/useDraggable.d.ts +66 -0
- package/lib/components/dnd/hooks/useDroppable.d.ts +73 -0
- package/lib/components/dnd/hooks/useSortable.d.ts +94 -0
- package/lib/components/dnd/index.d.ts +8 -0
- package/lib/components/filters/FilterContext.d.ts +34 -0
- package/lib/components/filters/core/ActiveFilters/ActiveFilters.d.ts +16 -0
- package/lib/components/filters/core/ActiveFilters/index.d.ts +2 -0
- package/lib/components/filters/core/FilterField/FilterField.d.ts +17 -0
- package/lib/components/filters/core/FilterField/index.d.ts +2 -0
- package/lib/components/filters/core/FilterProvider/FilterProvider.d.ts +4 -0
- package/lib/components/filters/core/FilterProvider/index.d.ts +2 -0
- package/lib/components/filters/core/FilterSection/FilterSection.d.ts +16 -0
- package/lib/components/filters/core/FilterSection/index.d.ts +2 -0
- package/lib/components/filters/core/index.d.ts +7 -0
- package/lib/components/filters/fields/CheckboxFilter.d.ts +17 -0
- package/lib/components/filters/fields/DateFilter.d.ts +21 -0
- package/lib/components/filters/fields/DateRangeFilter.d.ts +19 -0
- package/lib/components/filters/fields/ListSelectFilter.d.ts +19 -0
- package/lib/components/filters/fields/MultiSelectFilter.d.ts +19 -0
- package/lib/components/filters/fields/NumberFilter.d.ts +19 -0
- package/lib/components/filters/fields/NumberRangeFilter.d.ts +19 -0
- package/lib/components/filters/fields/RatingFilter.d.ts +19 -0
- package/lib/components/filters/fields/SelectFilter.d.ts +21 -0
- package/lib/components/filters/fields/TextFilter.d.ts +21 -0
- package/lib/components/filters/fields/ToggleFilter.d.ts +17 -0
- package/lib/components/filters/fields/index.d.ts +25 -0
- package/lib/components/filters/hooks/index.d.ts +9 -0
- package/lib/components/filters/hooks/useFilter.d.ts +57 -0
- package/lib/components/filters/hooks/useFilterDependencies.d.ts +40 -0
- package/lib/components/filters/hooks/useFilterOptions.d.ts +70 -0
- package/lib/components/filters/index.d.ts +43 -0
- package/lib/components/filters/layouts/FilterAccordion/FilterAccordion.d.ts +15 -0
- package/lib/components/filters/layouts/FilterAccordion/index.d.ts +2 -0
- package/lib/components/filters/layouts/FilterBar/FilterBar.d.ts +18 -0
- package/lib/components/filters/layouts/FilterBar/index.d.ts +2 -0
- package/lib/components/filters/layouts/FilterModal/FilterModal.d.ts +24 -0
- package/lib/components/filters/layouts/FilterModal/index.d.ts +2 -0
- package/lib/components/filters/layouts/FilterPopover/FilterPopover.d.ts +19 -0
- package/lib/components/filters/layouts/FilterPopover/index.d.ts +2 -0
- package/lib/components/filters/layouts/FilterSidebar/FilterSidebar.d.ts +20 -0
- package/lib/components/filters/layouts/FilterSidebar/index.d.ts +2 -0
- package/lib/components/filters/layouts/index.d.ts +8 -0
- package/lib/components/filters/types.d.ts +937 -0
- package/lib/components/index.d.ts +8 -0
- package/lib/components/inputs/Checkbox/Checkbox.d.ts +2 -2
- package/lib/components/inputs/NumberInput/NumberInput.d.ts +3 -1
- package/package.json +1 -2
- package/README.md +0 -826
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { KanbanCardRenderProps } from './KanbanCard';
|
|
3
|
+
import { BaseComponentProps, ComponentSize } from '../../../types/component.types';
|
|
4
|
+
/**
|
|
5
|
+
* Card data type
|
|
6
|
+
*/
|
|
7
|
+
export interface KanbanCardData {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for the card
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Additional card data
|
|
14
|
+
*/
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Column data type
|
|
19
|
+
*/
|
|
20
|
+
export interface KanbanColumnData {
|
|
21
|
+
/**
|
|
22
|
+
* Unique identifier for the column
|
|
23
|
+
*/
|
|
24
|
+
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* Column title
|
|
27
|
+
*/
|
|
28
|
+
title: string;
|
|
29
|
+
/**
|
|
30
|
+
* Cards in this column
|
|
31
|
+
*/
|
|
32
|
+
items: KanbanCardData[];
|
|
33
|
+
/**
|
|
34
|
+
* Additional column data
|
|
35
|
+
*/
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface KanbanBoardProps<T extends KanbanCardData> extends Omit<BaseComponentProps, 'onChange' | 'children'> {
|
|
39
|
+
/**
|
|
40
|
+
* Columns configuration
|
|
41
|
+
*/
|
|
42
|
+
columns: KanbanColumnData[];
|
|
43
|
+
/**
|
|
44
|
+
* Callback when a card is moved
|
|
45
|
+
*/
|
|
46
|
+
onCardMove?: (cardId: string, fromColumnId: string, toColumnId: string, fromIndex: number, toIndex: number) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Callback when columns are reordered
|
|
49
|
+
*/
|
|
50
|
+
onColumnReorder?: (columns: KanbanColumnData[]) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Render function for each card
|
|
53
|
+
*/
|
|
54
|
+
renderCard: (card: T, props: KanbanCardRenderProps) => ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Render function for column header
|
|
57
|
+
*/
|
|
58
|
+
renderColumnHeader?: (column: KanbanColumnData) => ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Gap between columns
|
|
61
|
+
* @default 'md'
|
|
62
|
+
*/
|
|
63
|
+
columnGap?: ComponentSize | number;
|
|
64
|
+
/**
|
|
65
|
+
* Gap between cards within a column
|
|
66
|
+
* @default 'sm'
|
|
67
|
+
*/
|
|
68
|
+
cardGap?: ComponentSize | number;
|
|
69
|
+
/**
|
|
70
|
+
* Column width
|
|
71
|
+
* @default 280
|
|
72
|
+
*/
|
|
73
|
+
columnWidth?: number | 'auto' | 'equal';
|
|
74
|
+
/**
|
|
75
|
+
* Minimum column height
|
|
76
|
+
* @default 200
|
|
77
|
+
*/
|
|
78
|
+
minColumnHeight?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Whether columns can be reordered
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
allowColumnReorder?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Whether to use drag handles for cards
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
useDragHandle?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Whether the board is disabled
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
disabled?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Horizontal scroll behavior
|
|
96
|
+
* @default 'scroll'
|
|
97
|
+
*/
|
|
98
|
+
overflowBehavior?: 'scroll' | 'wrap' | 'none';
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* KanbanBoard component for creating kanban-style boards
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* const [columns, setColumns] = useState([
|
|
106
|
+
* { id: 'todo', title: 'To Do', items: [{ id: '1', title: 'Task 1' }] },
|
|
107
|
+
* { id: 'doing', title: 'In Progress', items: [] },
|
|
108
|
+
* { id: 'done', title: 'Done', items: [] },
|
|
109
|
+
* ]);
|
|
110
|
+
*
|
|
111
|
+
* <KanbanBoard
|
|
112
|
+
* columns={columns}
|
|
113
|
+
* onCardMove={(cardId, fromCol, toCol, fromIdx, toIdx) => {
|
|
114
|
+
* // Update columns state
|
|
115
|
+
* }}
|
|
116
|
+
* renderCard={(card, { isDragging }) => (
|
|
117
|
+
* <div data-dragging={isDragging}>{card.title}</div>
|
|
118
|
+
* )}
|
|
119
|
+
* />
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export declare function KanbanBoard<T extends KanbanCardData>(props: KanbanBoardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
123
|
+
export declare namespace KanbanBoard {
|
|
124
|
+
var displayName: string;
|
|
125
|
+
}
|
|
126
|
+
export default KanbanBoard;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KanbanBoard context for sharing state across kanban components
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Card move event data
|
|
6
|
+
*/
|
|
7
|
+
export interface CardMoveEvent {
|
|
8
|
+
cardId: string;
|
|
9
|
+
fromColumnId: string;
|
|
10
|
+
toColumnId: string;
|
|
11
|
+
fromIndex: number;
|
|
12
|
+
toIndex: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* KanbanBoard context value
|
|
16
|
+
*/
|
|
17
|
+
export interface KanbanBoardContextValue {
|
|
18
|
+
/**
|
|
19
|
+
* Whether column reordering is allowed
|
|
20
|
+
*/
|
|
21
|
+
allowColumnReorder: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to use drag handles for cards
|
|
24
|
+
*/
|
|
25
|
+
useDragHandle: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the board is disabled
|
|
28
|
+
*/
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Column width
|
|
32
|
+
*/
|
|
33
|
+
columnWidth: number | 'auto' | 'equal';
|
|
34
|
+
/**
|
|
35
|
+
* Callback when a card is moved
|
|
36
|
+
*/
|
|
37
|
+
onCardMove: (event: CardMoveEvent) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback when columns are reordered
|
|
40
|
+
*/
|
|
41
|
+
onColumnReorder: (fromIndex: number, toIndex: number) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Get the ID of the currently dragged card
|
|
44
|
+
*/
|
|
45
|
+
getActiveCardId: () => string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Get the ID of the column being dragged over
|
|
48
|
+
*/
|
|
49
|
+
getOverColumnId: () => string | null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* KanbanBoard context
|
|
53
|
+
*/
|
|
54
|
+
export declare const KanbanBoardContext: import('react').Context<KanbanBoardContextValue | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Hook to access KanbanBoard context (throws if not in provider)
|
|
57
|
+
*/
|
|
58
|
+
export declare function useKanbanBoardContext(): KanbanBoardContextValue;
|
|
59
|
+
/**
|
|
60
|
+
* Hook to access KanbanBoard context (returns null if not in provider)
|
|
61
|
+
*/
|
|
62
|
+
export declare function useKanbanBoardContextOptional(): KanbanBoardContextValue | null;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { default as React, ReactNode, DragEvent } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
/**
|
|
4
|
+
* Props passed to renderCard function
|
|
5
|
+
*/
|
|
6
|
+
export interface KanbanCardRenderProps {
|
|
7
|
+
/**
|
|
8
|
+
* Whether this card is being dragged
|
|
9
|
+
*/
|
|
10
|
+
isDragging: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether another card is being dragged over this card
|
|
13
|
+
*/
|
|
14
|
+
isOver: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Props to spread on a drag handle element
|
|
17
|
+
*/
|
|
18
|
+
dragHandleProps?: {
|
|
19
|
+
draggable: boolean;
|
|
20
|
+
onDragStart: (event: DragEvent<HTMLElement>) => void;
|
|
21
|
+
onDragEnd: (event: DragEvent<HTMLElement>) => void;
|
|
22
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
23
|
+
role: string;
|
|
24
|
+
tabIndex: number;
|
|
25
|
+
'aria-grabbed': boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Column ID this card belongs to
|
|
29
|
+
*/
|
|
30
|
+
columnId: string;
|
|
31
|
+
/**
|
|
32
|
+
* Index of the card in the column
|
|
33
|
+
*/
|
|
34
|
+
index: number;
|
|
35
|
+
}
|
|
36
|
+
export interface KanbanCardProps extends Omit<BaseComponentProps, 'children'> {
|
|
37
|
+
/**
|
|
38
|
+
* Unique identifier for this card
|
|
39
|
+
*/
|
|
40
|
+
id: string;
|
|
41
|
+
/**
|
|
42
|
+
* ID of the column this card belongs to
|
|
43
|
+
*/
|
|
44
|
+
columnId: string;
|
|
45
|
+
/**
|
|
46
|
+
* Index of this card in the column
|
|
47
|
+
*/
|
|
48
|
+
index: number;
|
|
49
|
+
/**
|
|
50
|
+
* Whether this card is disabled
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Additional data associated with this card
|
|
56
|
+
*/
|
|
57
|
+
data?: Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Card content - can be a ReactNode or a render function
|
|
60
|
+
*/
|
|
61
|
+
children?: ReactNode | ((props: KanbanCardRenderProps) => ReactNode);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* KanbanCard component for use within KanbanColumn
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```tsx
|
|
68
|
+
* <KanbanCard id="card-1" columnId="todo" index={0}>
|
|
69
|
+
* {({ isDragging }) => (
|
|
70
|
+
* <div data-dragging={isDragging}>Card content</div>
|
|
71
|
+
* )}
|
|
72
|
+
* </KanbanCard>
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const KanbanCard: React.ForwardRefExoticComponent<KanbanCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
76
|
+
export default KanbanCard;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface KanbanColumnProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for this column
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Index of this column in the board
|
|
10
|
+
*/
|
|
11
|
+
index: number;
|
|
12
|
+
/**
|
|
13
|
+
* Column title
|
|
14
|
+
*/
|
|
15
|
+
title?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Custom header content
|
|
18
|
+
*/
|
|
19
|
+
header?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Whether this column is disabled
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Additional data associated with this column
|
|
27
|
+
*/
|
|
28
|
+
data?: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* KanbanColumn component for use within KanbanBoard
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <KanbanColumn id="todo" index={0} title="To Do">
|
|
36
|
+
* <KanbanCard id="card-1" columnId="todo" index={0}>
|
|
37
|
+
* Card content
|
|
38
|
+
* </KanbanCard>
|
|
39
|
+
* </KanbanColumn>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const KanbanColumn: React.ForwardRefExoticComponent<KanbanColumnProps & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
+
export default KanbanColumn;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { KanbanBoard, type KanbanBoardProps, type KanbanCardData, type KanbanColumnData } from './KanbanBoard';
|
|
2
|
+
export { KanbanColumn, type KanbanColumnProps } from './KanbanColumn';
|
|
3
|
+
export { KanbanCard, type KanbanCardProps, type KanbanCardRenderProps } from './KanbanCard';
|
|
4
|
+
export { KanbanBoardContext, useKanbanBoardContext, useKanbanBoardContextOptional, type KanbanBoardContextValue, type CardMoveEvent, } from './KanbanBoardContext';
|
|
5
|
+
export { default } from './KanbanBoard';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface ResizablePanelProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Unique panel ID
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Minimum size as percentage
|
|
10
|
+
* @default 10
|
|
11
|
+
*/
|
|
12
|
+
minSize?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum size as percentage
|
|
15
|
+
* @default 90
|
|
16
|
+
*/
|
|
17
|
+
maxSize?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Default size as percentage
|
|
20
|
+
*/
|
|
21
|
+
defaultSize?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Whether panel is collapsible
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
collapsible?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Collapsed state (controlled)
|
|
29
|
+
*/
|
|
30
|
+
collapsed?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when collapse state changes
|
|
33
|
+
*/
|
|
34
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* ResizablePanel component for use within ResizablePanels
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <ResizablePanels>
|
|
42
|
+
* <ResizablePanel minSize={20} defaultSize={30}>
|
|
43
|
+
* <Sidebar />
|
|
44
|
+
* </ResizablePanel>
|
|
45
|
+
* <ResizeHandle />
|
|
46
|
+
* <ResizablePanel>
|
|
47
|
+
* <MainContent />
|
|
48
|
+
* </ResizablePanel>
|
|
49
|
+
* </ResizablePanels>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const ResizablePanel: React.ForwardRefExoticComponent<ResizablePanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
53
|
+
export default ResizablePanel;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface ResizablePanelsProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Direction of panels
|
|
6
|
+
* @default 'horizontal'
|
|
7
|
+
*/
|
|
8
|
+
direction?: 'horizontal' | 'vertical';
|
|
9
|
+
/**
|
|
10
|
+
* Callback when panel sizes change
|
|
11
|
+
*/
|
|
12
|
+
onResize?: (sizes: number[]) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Controlled panel sizes (percentages)
|
|
15
|
+
*/
|
|
16
|
+
sizes?: number[];
|
|
17
|
+
/**
|
|
18
|
+
* Default panel sizes (percentages)
|
|
19
|
+
*/
|
|
20
|
+
defaultSizes?: number[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ResizablePanels component for creating resizable split layouts
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <ResizablePanels direction="horizontal" onResize={setSizes}>
|
|
28
|
+
* <ResizablePanel minSize={20} defaultSize={30}>
|
|
29
|
+
* <Sidebar />
|
|
30
|
+
* </ResizablePanel>
|
|
31
|
+
* <ResizeHandle />
|
|
32
|
+
* <ResizablePanel minSize={30}>
|
|
33
|
+
* <MainContent />
|
|
34
|
+
* </ResizablePanel>
|
|
35
|
+
* <ResizeHandle />
|
|
36
|
+
* <ResizablePanel minSize={20} collapsible>
|
|
37
|
+
* <DetailPanel />
|
|
38
|
+
* </ResizablePanel>
|
|
39
|
+
* </ResizablePanels>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const ResizablePanels: React.FC<ResizablePanelsProps>;
|
|
43
|
+
export default ResizablePanels;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResizablePanels context for sharing state across resizable components
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* ResizablePanels context value
|
|
6
|
+
*/
|
|
7
|
+
export interface ResizablePanelsContextValue {
|
|
8
|
+
/**
|
|
9
|
+
* Direction of panels
|
|
10
|
+
*/
|
|
11
|
+
direction: 'horizontal' | 'vertical';
|
|
12
|
+
/**
|
|
13
|
+
* Current panel sizes (percentages)
|
|
14
|
+
*/
|
|
15
|
+
sizes: number[];
|
|
16
|
+
/**
|
|
17
|
+
* Update panel sizes
|
|
18
|
+
*/
|
|
19
|
+
setSizes: (sizes: number[]) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Start resizing at a specific handle index
|
|
22
|
+
*/
|
|
23
|
+
startResize: (handleIndex: number) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Stop resizing
|
|
26
|
+
*/
|
|
27
|
+
stopResize: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* Currently active handle index (-1 if not resizing)
|
|
30
|
+
*/
|
|
31
|
+
activeHandle: number;
|
|
32
|
+
/**
|
|
33
|
+
* Register a panel and return its index
|
|
34
|
+
*/
|
|
35
|
+
registerPanel: (config: {
|
|
36
|
+
minSize: number;
|
|
37
|
+
maxSize: number;
|
|
38
|
+
collapsible: boolean;
|
|
39
|
+
}) => number;
|
|
40
|
+
/**
|
|
41
|
+
* Get panel config by index
|
|
42
|
+
*/
|
|
43
|
+
getPanelConfig: (index: number) => {
|
|
44
|
+
minSize: number;
|
|
45
|
+
maxSize: number;
|
|
46
|
+
collapsible: boolean;
|
|
47
|
+
} | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Total number of panels
|
|
50
|
+
*/
|
|
51
|
+
panelCount: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* ResizablePanels context
|
|
55
|
+
*/
|
|
56
|
+
export declare const ResizablePanelsContext: import('react').Context<ResizablePanelsContextValue | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Hook to access ResizablePanels context (throws if not in provider)
|
|
59
|
+
*/
|
|
60
|
+
export declare function useResizablePanelsContext(): ResizablePanelsContextValue;
|
|
61
|
+
/**
|
|
62
|
+
* Hook to access ResizablePanels context (returns null if not in provider)
|
|
63
|
+
*/
|
|
64
|
+
export declare function useResizablePanelsContextOptional(): ResizablePanelsContextValue | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface ResizeHandleProps extends Omit<BaseComponentProps, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* Visual style
|
|
6
|
+
* @default 'line'
|
|
7
|
+
*/
|
|
8
|
+
variant?: 'line' | 'dots' | 'hidden';
|
|
9
|
+
/**
|
|
10
|
+
* Whether to show on hover only
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
showOnHover?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* ResizeHandle component for use within ResizablePanels
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <ResizablePanels>
|
|
21
|
+
* <ResizablePanel>Content 1</ResizablePanel>
|
|
22
|
+
* <ResizeHandle variant="dots" />
|
|
23
|
+
* <ResizablePanel>Content 2</ResizablePanel>
|
|
24
|
+
* </ResizablePanels>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const ResizeHandle: React.ForwardRefExoticComponent<ResizeHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
export default ResizeHandle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ResizablePanels, type ResizablePanelsProps } from './ResizablePanels';
|
|
2
|
+
export { ResizablePanel, type ResizablePanelProps } from './ResizablePanel';
|
|
3
|
+
export { ResizeHandle, type ResizeHandleProps } from './ResizeHandle';
|
|
4
|
+
export { ResizablePanelsContext, useResizablePanelsContext, useResizablePanelsContextOptional, type ResizablePanelsContextValue, } from './ResizablePanelsContext';
|
|
5
|
+
export { default } from './ResizablePanels';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SortableGridItemRenderProps } from './SortableGridItem';
|
|
3
|
+
import { BaseComponentProps, ComponentSize } from '../../../types/component.types';
|
|
4
|
+
/**
|
|
5
|
+
* Item type for SortableGrid
|
|
6
|
+
*/
|
|
7
|
+
export interface SortableGridItemData {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for the item
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
/**
|
|
13
|
+
* Additional item data
|
|
14
|
+
*/
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface SortableGridProps<T extends SortableGridItemData> extends Omit<BaseComponentProps, 'onChange' | 'children'> {
|
|
18
|
+
/**
|
|
19
|
+
* Items to render
|
|
20
|
+
*/
|
|
21
|
+
items: T[];
|
|
22
|
+
/**
|
|
23
|
+
* Callback when items are reordered
|
|
24
|
+
*/
|
|
25
|
+
onReorder?: (items: T[]) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Render function for each item
|
|
28
|
+
*/
|
|
29
|
+
renderItem: (item: T, props: SortableGridItemRenderProps) => ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Number of columns
|
|
32
|
+
* @default 'auto'
|
|
33
|
+
*/
|
|
34
|
+
columns?: number | 'auto';
|
|
35
|
+
/**
|
|
36
|
+
* Minimum item width (for auto columns)
|
|
37
|
+
* @default 150
|
|
38
|
+
*/
|
|
39
|
+
minItemWidth?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Gap between items
|
|
42
|
+
* @default 'md'
|
|
43
|
+
*/
|
|
44
|
+
gap?: ComponentSize | number;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the grid is disabled
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* SortableGrid component for creating reorderable grid layouts
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```tsx
|
|
56
|
+
* const [items, setItems] = useState([
|
|
57
|
+
* { id: '1', image: '/img1.jpg' },
|
|
58
|
+
* { id: '2', image: '/img2.jpg' },
|
|
59
|
+
* { id: '3', image: '/img3.jpg' },
|
|
60
|
+
* ]);
|
|
61
|
+
*
|
|
62
|
+
* <SortableGrid
|
|
63
|
+
* items={items}
|
|
64
|
+
* onReorder={setItems}
|
|
65
|
+
* columns={3}
|
|
66
|
+
* renderItem={(item, { isDragging }) => (
|
|
67
|
+
* <img src={item.image} data-dragging={isDragging} />
|
|
68
|
+
* )}
|
|
69
|
+
* />
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function SortableGrid<T extends SortableGridItemData>({ items, onReorder, renderItem, columns, minItemWidth, gap, disabled, className, 'data-testid': dataTestId, 'aria-label': ariaLabel, style, }: SortableGridProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
73
|
+
export declare namespace SortableGrid {
|
|
74
|
+
var displayName: string;
|
|
75
|
+
}
|
|
76
|
+
export default SortableGrid;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
/**
|
|
4
|
+
* Props passed to renderItem function
|
|
5
|
+
*/
|
|
6
|
+
export interface SortableGridItemRenderProps {
|
|
7
|
+
/**
|
|
8
|
+
* Whether this item is being dragged
|
|
9
|
+
*/
|
|
10
|
+
isDragging: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether another item is being dragged over this item
|
|
13
|
+
*/
|
|
14
|
+
isOver: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Index of the item in the grid
|
|
17
|
+
*/
|
|
18
|
+
index: number;
|
|
19
|
+
}
|
|
20
|
+
export interface SortableGridItemProps extends Omit<BaseComponentProps, 'children'> {
|
|
21
|
+
/**
|
|
22
|
+
* Unique identifier for this item
|
|
23
|
+
*/
|
|
24
|
+
id: string;
|
|
25
|
+
/**
|
|
26
|
+
* Index of this item in the grid
|
|
27
|
+
*/
|
|
28
|
+
index: number;
|
|
29
|
+
/**
|
|
30
|
+
* Whether this item is disabled
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Data associated with this item
|
|
36
|
+
*/
|
|
37
|
+
data?: Record<string, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Content to render - can be a ReactNode or a render function
|
|
40
|
+
*/
|
|
41
|
+
children?: ReactNode | ((props: SortableGridItemRenderProps) => ReactNode);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* SortableGridItem component for use within SortableGrid
|
|
45
|
+
*/
|
|
46
|
+
export declare const SortableGridItem: React.ForwardRefExoticComponent<SortableGridItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
+
export default SortableGridItem;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { SortableGrid, type SortableGridProps, type SortableGridItemData } from './SortableGrid';
|
|
2
|
+
export { SortableGridItem as SortableGridItemComponent, type SortableGridItemProps, type SortableGridItemRenderProps, } from './SortableGridItem';
|
|
3
|
+
export { default } from './SortableGrid';
|