@true-tech-team/react-components 0.0.4 → 0.0.6
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.d.ts +10 -0
- package/index.js +1 -1
- package/index.mjs +15961 -6871
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroup.d.ts +79 -0
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupContext.d.ts +38 -0
- package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupItem.d.ts +37 -0
- package/lib/components/buttons/ButtonToggleGroup/index.d.ts +7 -0
- package/lib/components/buttons/ToggleButton/ToggleButton.d.ts +96 -0
- package/lib/components/buttons/ToggleButton/index.d.ts +3 -0
- package/lib/components/display/Icon/icons/BookmarkFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/ChevronsLeft.d.ts +3 -0
- package/lib/components/display/Icon/icons/ChevronsRight.d.ts +3 -0
- package/lib/components/display/Icon/icons/HeartFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/More.d.ts +3 -0
- package/lib/components/display/Icon/icons/StarFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/ThumbsUpFilled.d.ts +3 -0
- package/lib/components/display/Icon/icons/index.d.ts +15 -1
- 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/OverflowText/OverflowText.d.ts +81 -0
- package/lib/components/display/OverflowText/index.d.ts +2 -0
- package/lib/components/display/ScrollArea/ScrollArea.d.ts +112 -0
- package/lib/components/display/ScrollArea/index.d.ts +3 -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/Tabs/Tab.d.ts +41 -0
- package/lib/components/display/Tabs/TabList.d.ts +27 -0
- package/lib/components/display/Tabs/TabPanel.d.ts +31 -0
- package/lib/components/display/Tabs/Tabs.d.ts +90 -0
- package/lib/components/display/Tabs/TabsContext.d.ts +63 -0
- package/lib/components/display/Tabs/index.d.ts +11 -0
- package/lib/components/display/TruncatedList/TruncatedList.d.ts +69 -0
- package/lib/components/display/TruncatedList/index.d.ts +2 -0
- package/lib/components/display/index.d.ts +4 -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 +52 -0
- package/lib/components/inputs/Checkbox/Checkbox.d.ts +2 -2
- package/lib/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +122 -0
- package/lib/components/inputs/CheckboxGroup/CheckboxGroupContext.d.ts +42 -0
- package/lib/components/inputs/CheckboxGroup/CheckboxGroupItem.d.ts +50 -0
- package/lib/components/inputs/CheckboxGroup/index.d.ts +7 -0
- package/lib/components/inputs/NumberInput/NumberInput.d.ts +3 -1
- package/lib/components/layout/AdaptiveGrid/AdaptiveGrid.d.ts +100 -0
- package/lib/components/layout/AdaptiveGrid/index.d.ts +2 -0
- package/lib/components/layout/MasonryLayout/MasonryLayout.d.ts +74 -0
- package/lib/components/layout/MasonryLayout/index.d.ts +2 -0
- package/lib/components/layout/Panes/Pane.d.ts +72 -0
- package/lib/components/layout/Panes/Panes.d.ts +75 -0
- package/lib/components/layout/Panes/PanesContext.d.ts +60 -0
- package/lib/components/layout/Panes/index.d.ts +6 -0
- package/lib/components/layout/ResponsiveStack/ResponsiveStack.d.ts +99 -0
- package/lib/components/layout/ResponsiveStack/index.d.ts +2 -0
- package/lib/components/layout/index.d.ts +4 -0
- package/lib/components/navigation/BottomNavigation/BottomNavigation.d.ts +53 -0
- package/lib/components/navigation/BottomNavigation/BottomNavigationContext.d.ts +27 -0
- package/lib/components/navigation/BottomNavigation/BottomNavigationItem.d.ts +59 -0
- package/lib/components/navigation/BottomNavigation/index.d.ts +7 -0
- package/lib/components/navigation/Breadcrumbs/BreadcrumbItem.d.ts +37 -0
- package/lib/components/navigation/Breadcrumbs/BreadcrumbSeparator.d.ts +22 -0
- package/lib/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +96 -0
- package/lib/components/navigation/Breadcrumbs/index.d.ts +9 -0
- package/lib/components/navigation/Breadcrumbs/useBreadcrumbsFromPath.d.ts +73 -0
- package/lib/components/navigation/CollapsibleSidebar/CollapsibleSidebar.d.ts +113 -0
- package/lib/components/navigation/CollapsibleSidebar/index.d.ts +2 -0
- package/lib/components/navigation/NavLink/NavLink.d.ts +74 -0
- package/lib/components/navigation/NavLink/index.d.ts +3 -0
- package/lib/components/navigation/Navbar/Navbar.d.ts +81 -0
- package/lib/components/navigation/Navbar/NavbarActions.d.ts +21 -0
- package/lib/components/navigation/Navbar/NavbarBrand.d.ts +29 -0
- package/lib/components/navigation/Navbar/NavbarCollapse.d.ts +26 -0
- package/lib/components/navigation/Navbar/NavbarContext.d.ts +50 -0
- package/lib/components/navigation/Navbar/NavbarNav.d.ts +22 -0
- package/lib/components/navigation/Navbar/NavbarToggle.d.ts +21 -0
- package/lib/components/navigation/Navbar/index.d.ts +15 -0
- package/lib/components/navigation/Pagination/Pagination.d.ts +99 -0
- package/lib/components/navigation/Pagination/index.d.ts +3 -0
- package/lib/components/navigation/SideNav/SideNav.d.ts +89 -0
- package/lib/components/navigation/SideNav/SideNavContext.d.ts +43 -0
- package/lib/components/navigation/SideNav/SideNavDivider.d.ts +22 -0
- package/lib/components/navigation/SideNav/SideNavGroup.d.ts +44 -0
- package/lib/components/navigation/SideNav/SideNavItem.d.ts +71 -0
- package/lib/components/navigation/SideNav/index.d.ts +11 -0
- package/lib/components/navigation/Stepper/Step.d.ts +57 -0
- package/lib/components/navigation/Stepper/Stepper.d.ts +80 -0
- package/lib/components/navigation/Stepper/StepperContext.d.ts +58 -0
- package/lib/components/navigation/Stepper/index.d.ts +7 -0
- package/lib/components/navigation/index.d.ts +16 -0
- package/lib/components/overlays/Alert/Alert.d.ts +102 -0
- package/lib/components/overlays/Alert/AlertContext.d.ts +94 -0
- package/lib/components/overlays/Alert/AlertPresets.d.ts +42 -0
- package/lib/components/overlays/Alert/AlertProvider.d.ts +40 -0
- package/lib/components/overlays/Alert/index.d.ts +11 -0
- package/lib/components/overlays/Dialog/Dialog.d.ts +197 -0
- package/lib/components/overlays/Dialog/DialogContext.d.ts +75 -0
- package/lib/components/overlays/Dialog/DialogProvider.d.ts +30 -0
- package/lib/components/overlays/Dialog/index.d.ts +9 -0
- package/lib/components/overlays/Toast/Toast.d.ts +103 -0
- package/lib/components/overlays/Toast/ToastContainer.d.ts +37 -0
- package/lib/components/overlays/Toast/ToastContext.d.ts +126 -0
- package/lib/components/overlays/Toast/ToastProvider.d.ts +71 -0
- package/lib/components/overlays/Toast/index.d.ts +11 -0
- package/lib/hooks/index.d.ts +10 -0
- package/lib/hooks/useAlert/index.d.ts +2 -0
- package/lib/hooks/useAlert/useAlert.d.ts +99 -0
- package/lib/hooks/useAsyncToast/index.d.ts +2 -0
- package/lib/hooks/useAsyncToast/useAsyncToast.d.ts +93 -0
- package/lib/hooks/useDialog/index.d.ts +2 -0
- package/lib/hooks/useDialog/useDialog.d.ts +58 -0
- package/lib/hooks/useResizeObserver/index.d.ts +2 -0
- package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +69 -0
- package/lib/hooks/useToast/index.d.ts +2 -0
- package/lib/hooks/useToast/useToast.d.ts +97 -0
- package/lib/providers/GlobalProvider/GlobalProvider.d.ts +16 -1
- package/package.json +1 -1
- package/README.md +0 -688
|
@@ -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 renderItem function
|
|
5
|
+
*/
|
|
6
|
+
export interface SortableItemRenderProps {
|
|
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
|
+
* 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
|
+
* Index of the item in the list
|
|
29
|
+
*/
|
|
30
|
+
index: number;
|
|
31
|
+
}
|
|
32
|
+
export interface SortableItemProps extends Omit<BaseComponentProps, 'children'> {
|
|
33
|
+
/**
|
|
34
|
+
* Unique identifier for this item
|
|
35
|
+
*/
|
|
36
|
+
id: string;
|
|
37
|
+
/**
|
|
38
|
+
* Index of this item in the list
|
|
39
|
+
*/
|
|
40
|
+
index: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether this item is disabled
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Element to render as
|
|
48
|
+
* @default 'div'
|
|
49
|
+
*/
|
|
50
|
+
as?: React.ElementType;
|
|
51
|
+
/**
|
|
52
|
+
* Data associated with this item
|
|
53
|
+
*/
|
|
54
|
+
data?: Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Content to render - can be a ReactNode or a render function
|
|
57
|
+
*/
|
|
58
|
+
children?: ReactNode | ((props: SortableItemRenderProps) => ReactNode);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* SortableItem component for use within SortableList
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <SortableItem id="item-1" index={0}>
|
|
66
|
+
* {({ isDragging, dragHandleProps }) => (
|
|
67
|
+
* <>
|
|
68
|
+
* <DragHandle {...dragHandleProps} />
|
|
69
|
+
* <span>Item content</span>
|
|
70
|
+
* </>
|
|
71
|
+
* )}
|
|
72
|
+
* </SortableItem>
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const SortableItem: React.ForwardRefExoticComponent<SortableItemProps & React.RefAttributes<HTMLElement>>;
|
|
76
|
+
export default SortableItem;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SortableItemRenderProps } from './SortableItem';
|
|
3
|
+
import { BaseComponentProps, ComponentSize } from '../../../types/component.types';
|
|
4
|
+
/**
|
|
5
|
+
* Item type for SortableList
|
|
6
|
+
*/
|
|
7
|
+
export interface SortableListItem {
|
|
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 SortableListProps<T extends SortableListItem> 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
|
+
* Callback when reorder completes (with from/to indices)
|
|
28
|
+
*/
|
|
29
|
+
onReorderComplete?: (items: T[], fromIndex: number, toIndex: number) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Render function for each item
|
|
32
|
+
*/
|
|
33
|
+
renderItem: (item: T, props: SortableItemRenderProps) => ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Gap between items
|
|
36
|
+
* @default 'md'
|
|
37
|
+
*/
|
|
38
|
+
gap?: ComponentSize | number;
|
|
39
|
+
/**
|
|
40
|
+
* Sorting direction
|
|
41
|
+
* @default 'vertical'
|
|
42
|
+
*/
|
|
43
|
+
direction?: 'vertical' | 'horizontal';
|
|
44
|
+
/**
|
|
45
|
+
* Group ID for cross-list drag
|
|
46
|
+
*/
|
|
47
|
+
groupId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether to use drag handles (requires DragHandle in renderItem)
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
useDragHandle?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the list is disabled
|
|
55
|
+
* @default false
|
|
56
|
+
*/
|
|
57
|
+
disabled?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* SortableList component for creating reorderable lists
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* const [items, setItems] = useState([
|
|
65
|
+
* { id: '1', name: 'Item 1' },
|
|
66
|
+
* { id: '2', name: 'Item 2' },
|
|
67
|
+
* { id: '3', name: 'Item 3' },
|
|
68
|
+
* ]);
|
|
69
|
+
*
|
|
70
|
+
* <SortableList
|
|
71
|
+
* items={items}
|
|
72
|
+
* onReorder={setItems}
|
|
73
|
+
* renderItem={(item, { isDragging }) => (
|
|
74
|
+
* <div data-dragging={isDragging}>{item.name}</div>
|
|
75
|
+
* )}
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example with drag handle
|
|
80
|
+
* ```tsx
|
|
81
|
+
* <SortableList
|
|
82
|
+
* items={items}
|
|
83
|
+
* onReorder={setItems}
|
|
84
|
+
* useDragHandle
|
|
85
|
+
* renderItem={(item, { isDragging, dragHandleProps }) => (
|
|
86
|
+
* <div data-dragging={isDragging}>
|
|
87
|
+
* <DragHandle {...dragHandleProps} />
|
|
88
|
+
* <span>{item.name}</span>
|
|
89
|
+
* </div>
|
|
90
|
+
* )}
|
|
91
|
+
* />
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function SortableList<T extends SortableListItem>(props: SortableListProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
export declare namespace SortableList {
|
|
96
|
+
var displayName: string;
|
|
97
|
+
}
|
|
98
|
+
export default SortableList;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DragData } from '../DndProvider';
|
|
2
|
+
/**
|
|
3
|
+
* SortableList context value
|
|
4
|
+
*/
|
|
5
|
+
export interface SortableListContextValue {
|
|
6
|
+
/**
|
|
7
|
+
* Direction of the list
|
|
8
|
+
*/
|
|
9
|
+
direction: 'vertical' | 'horizontal';
|
|
10
|
+
/**
|
|
11
|
+
* Whether to use drag handles
|
|
12
|
+
*/
|
|
13
|
+
useDragHandle: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Group ID for cross-list sorting
|
|
16
|
+
*/
|
|
17
|
+
groupId?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the list is disabled
|
|
20
|
+
*/
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Callback when an item is moved
|
|
24
|
+
*/
|
|
25
|
+
onItemMove: (fromIndex: number, toIndex: number) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the current active drag data
|
|
28
|
+
*/
|
|
29
|
+
getActiveData: () => DragData | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* SortableList context
|
|
33
|
+
*/
|
|
34
|
+
export declare const SortableListContext: import('react').Context<SortableListContextValue | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Hook to access SortableList context (throws if not in provider)
|
|
37
|
+
*/
|
|
38
|
+
export declare function useSortableListContext(): SortableListContextValue;
|
|
39
|
+
/**
|
|
40
|
+
* Hook to access SortableList context (returns null if not in provider)
|
|
41
|
+
*/
|
|
42
|
+
export declare function useSortableListContextOptional(): SortableListContextValue | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { SortableList, type SortableListProps, type SortableListItem } from './SortableList';
|
|
2
|
+
export { SortableItem, type SortableItemProps, type SortableItemRenderProps } from './SortableItem';
|
|
3
|
+
export { SortableListContext, useSortableListContext, useSortableListContextOptional, type SortableListContextValue, } from './SortableListContext';
|
|
4
|
+
export { default } from './SortableList';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useDraggable, type UseDraggableOptions, type UseDraggableReturn } from './useDraggable';
|
|
2
|
+
export { useDroppable, type UseDroppableOptions, type UseDroppableReturn } from './useDroppable';
|
|
3
|
+
export { useSortable, type UseSortableOptions, type UseSortableReturn } from './useSortable';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DragEvent } from 'react';
|
|
2
|
+
import { DragData } from '../DndProvider';
|
|
3
|
+
export interface UseDraggableOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for this draggable
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Data attached to this draggable
|
|
10
|
+
*/
|
|
11
|
+
data?: Omit<DragData, 'id'>;
|
|
12
|
+
/**
|
|
13
|
+
* Whether dragging is disabled
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface UseDraggableReturn {
|
|
18
|
+
/**
|
|
19
|
+
* Whether this element is currently being dragged
|
|
20
|
+
*/
|
|
21
|
+
isDragging: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Ref to attach to the draggable element
|
|
24
|
+
*/
|
|
25
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Attributes to spread on the draggable element
|
|
28
|
+
*/
|
|
29
|
+
attributes: {
|
|
30
|
+
draggable: boolean;
|
|
31
|
+
'aria-grabbed': boolean;
|
|
32
|
+
'data-dragging': boolean;
|
|
33
|
+
role: string;
|
|
34
|
+
tabIndex: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Event listeners to spread on the draggable element
|
|
38
|
+
*/
|
|
39
|
+
listeners: {
|
|
40
|
+
onDragStart: (event: DragEvent<HTMLElement>) => void;
|
|
41
|
+
onDragEnd: (event: DragEvent<HTMLElement>) => void;
|
|
42
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* The element node ref
|
|
46
|
+
*/
|
|
47
|
+
node: HTMLElement | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Hook to make an element draggable
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* const { setNodeRef, attributes, listeners, isDragging } = useDraggable({
|
|
55
|
+
* id: 'item-1',
|
|
56
|
+
* data: { type: 'card', index: 0 },
|
|
57
|
+
* });
|
|
58
|
+
*
|
|
59
|
+
* return (
|
|
60
|
+
* <div ref={setNodeRef} {...attributes} {...listeners} data-dragging={isDragging}>
|
|
61
|
+
* Drag me!
|
|
62
|
+
* </div>
|
|
63
|
+
* );
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function useDraggable(options: UseDraggableOptions): UseDraggableReturn;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DragEvent } from 'react';
|
|
2
|
+
import { DragData, ActiveDrag } from '../DndProvider';
|
|
3
|
+
export interface UseDroppableOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for this droppable
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Data attached to this droppable (for validation/filtering)
|
|
10
|
+
*/
|
|
11
|
+
data?: Omit<DragData, 'id'>;
|
|
12
|
+
/**
|
|
13
|
+
* Whether dropping is disabled
|
|
14
|
+
*/
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Types of draggables this droppable accepts (by type field in data)
|
|
18
|
+
* If not specified, accepts all types
|
|
19
|
+
*/
|
|
20
|
+
accepts?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface UseDroppableReturn {
|
|
23
|
+
/**
|
|
24
|
+
* Whether a draggable is currently over this droppable
|
|
25
|
+
*/
|
|
26
|
+
isOver: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The currently active drag item (if any)
|
|
29
|
+
*/
|
|
30
|
+
active: ActiveDrag | null;
|
|
31
|
+
/**
|
|
32
|
+
* Ref to attach to the droppable element
|
|
33
|
+
*/
|
|
34
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Attributes to spread on the droppable element
|
|
37
|
+
*/
|
|
38
|
+
attributes: {
|
|
39
|
+
'aria-dropeffect': 'move' | 'none';
|
|
40
|
+
'data-over': boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Event listeners to spread on the droppable element
|
|
44
|
+
*/
|
|
45
|
+
listeners: {
|
|
46
|
+
onDragEnter: (event: DragEvent<HTMLElement>) => void;
|
|
47
|
+
onDragLeave: (event: DragEvent<HTMLElement>) => void;
|
|
48
|
+
onDragOver: (event: DragEvent<HTMLElement>) => void;
|
|
49
|
+
onDrop: (event: DragEvent<HTMLElement>) => void;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The element node ref
|
|
53
|
+
*/
|
|
54
|
+
node: HTMLElement | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Hook to make an element a drop target
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* const { setNodeRef, attributes, listeners, isOver } = useDroppable({
|
|
62
|
+
* id: 'drop-zone-1',
|
|
63
|
+
* accepts: ['card'],
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* return (
|
|
67
|
+
* <div ref={setNodeRef} {...attributes} {...listeners} data-over={isOver}>
|
|
68
|
+
* Drop here
|
|
69
|
+
* </div>
|
|
70
|
+
* );
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function useDroppable(options: UseDroppableOptions): UseDroppableReturn;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { DragEvent } from 'react';
|
|
2
|
+
import { DragData, ActiveDrag } from '../DndProvider';
|
|
3
|
+
export interface UseSortableOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for this sortable item
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* Index of this item in the list
|
|
10
|
+
*/
|
|
11
|
+
index: number;
|
|
12
|
+
/**
|
|
13
|
+
* Data attached to this sortable item
|
|
14
|
+
*/
|
|
15
|
+
data?: Omit<DragData, 'id' | 'index'>;
|
|
16
|
+
/**
|
|
17
|
+
* Whether sorting is disabled
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Group ID for cross-list sorting
|
|
22
|
+
*/
|
|
23
|
+
groupId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UseSortableReturn {
|
|
26
|
+
/**
|
|
27
|
+
* Whether this item is currently being dragged
|
|
28
|
+
*/
|
|
29
|
+
isDragging: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether a draggable is currently over this item
|
|
32
|
+
*/
|
|
33
|
+
isOver: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The currently active drag item (if any)
|
|
36
|
+
*/
|
|
37
|
+
active: ActiveDrag | null;
|
|
38
|
+
/**
|
|
39
|
+
* Ref to attach to the sortable element
|
|
40
|
+
*/
|
|
41
|
+
setNodeRef: (node: HTMLElement | null) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Attributes to spread on the sortable element
|
|
44
|
+
*/
|
|
45
|
+
attributes: {
|
|
46
|
+
draggable: boolean;
|
|
47
|
+
'aria-grabbed': boolean;
|
|
48
|
+
'data-dragging': boolean;
|
|
49
|
+
'data-over': boolean;
|
|
50
|
+
role: string;
|
|
51
|
+
tabIndex: number;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Event listeners to spread on the sortable element
|
|
55
|
+
*/
|
|
56
|
+
listeners: {
|
|
57
|
+
onDragStart: (event: DragEvent<HTMLElement>) => void;
|
|
58
|
+
onDragEnd: (event: DragEvent<HTMLElement>) => void;
|
|
59
|
+
onDragEnter: (event: DragEvent<HTMLElement>) => void;
|
|
60
|
+
onDragLeave: (event: DragEvent<HTMLElement>) => void;
|
|
61
|
+
onDragOver: (event: DragEvent<HTMLElement>) => void;
|
|
62
|
+
onDrop: (event: DragEvent<HTMLElement>) => void;
|
|
63
|
+
onKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* CSS transform style for animation
|
|
67
|
+
*/
|
|
68
|
+
style: {
|
|
69
|
+
transition?: string;
|
|
70
|
+
opacity?: number;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Get the element node (use this instead of accessing node directly)
|
|
74
|
+
*/
|
|
75
|
+
getNode: () => HTMLElement | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Hook to make an element sortable (draggable and droppable)
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* const { setNodeRef, attributes, listeners, isDragging, isOver } = useSortable({
|
|
83
|
+
* id: 'item-1',
|
|
84
|
+
* index: 0,
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* return (
|
|
88
|
+
* <div ref={setNodeRef} {...attributes} {...listeners}>
|
|
89
|
+
* Sortable item
|
|
90
|
+
* </div>
|
|
91
|
+
* );
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function useSortable(options: UseSortableOptions): UseSortableReturn;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FilterContextValue } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Filter context
|
|
4
|
+
* Provides state coordination for filter components
|
|
5
|
+
*/
|
|
6
|
+
export declare const FilterContext: import('react').Context<FilterContextValue | null>;
|
|
7
|
+
/**
|
|
8
|
+
* Hook to optionally access filter context
|
|
9
|
+
* Returns null if not within FilterProvider
|
|
10
|
+
*
|
|
11
|
+
* @returns FilterContextValue or null if outside provider
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const context = useFilterContext();
|
|
16
|
+
* if (context) {
|
|
17
|
+
* // Use context...
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useFilterContext(): FilterContextValue | null;
|
|
22
|
+
/**
|
|
23
|
+
* Hook that throws if not within FilterProvider
|
|
24
|
+
* Use this when filter components must be within a provider
|
|
25
|
+
*
|
|
26
|
+
* @throws Error if used outside FilterProvider
|
|
27
|
+
* @returns FilterContextValue
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const { values, setFilterValue } = useFilterContextStrict();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function useFilterContextStrict(): FilterContextValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ActiveFiltersProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* ActiveFilters displays the currently applied filters as removable chips.
|
|
5
|
+
* Provides an easy way for users to see and remove active filters.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <FilterProvider filters={filters}>
|
|
10
|
+
* <ActiveFilters maxVisible={5} showClearAll />
|
|
11
|
+
* <FilterSidebar>...</FilterSidebar>
|
|
12
|
+
* </FilterProvider>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const ActiveFilters: React.ForwardRefExoticComponent<ActiveFiltersProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default ActiveFilters;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FilterFieldProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* FilterField is a unified wrapper that automatically renders the appropriate
|
|
5
|
+
* filter component based on the filter definition's type.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <FilterProvider filters={filters}>
|
|
10
|
+
* <FilterField filterId="status" />
|
|
11
|
+
* <FilterField filterId="dateRange" showLabel={false} />
|
|
12
|
+
* <FilterField filterId="search" placeholder="Search..." />
|
|
13
|
+
* </FilterProvider>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare const FilterField: React.ForwardRefExoticComponent<FilterFieldProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default FilterField;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FilterSectionProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* FilterSection provides a collapsible container for grouping related filters.
|
|
5
|
+
* Shows an optional badge with the count of active filters in the section.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <FilterSection title="Product" collapsible showActiveCount>
|
|
10
|
+
* <FilterField filterId="category" />
|
|
11
|
+
* <FilterField filterId="brand" />
|
|
12
|
+
* </FilterSection>
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const FilterSection: React.ForwardRefExoticComponent<FilterSectionProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default FilterSection;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
export interface CheckboxFilterProps extends BaseComponentProps {
|
|
4
|
+
/** Filter ID from FilterDefinition */
|
|
5
|
+
filterId: string;
|
|
6
|
+
/** Override label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Size variant */
|
|
9
|
+
size?: ComponentSize;
|
|
10
|
+
/** Additional props for Checkbox component */
|
|
11
|
+
checkboxProps?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CheckboxFilter wraps the Checkbox component for boolean filters
|
|
15
|
+
*/
|
|
16
|
+
export declare const CheckboxFilter: React.ForwardRefExoticComponent<CheckboxFilterProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default CheckboxFilter;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
export interface DateFilterProps extends BaseComponentProps {
|
|
4
|
+
/** Filter ID from FilterDefinition */
|
|
5
|
+
filterId: string;
|
|
6
|
+
/** Override label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Override placeholder */
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** Show label */
|
|
11
|
+
showLabel?: boolean;
|
|
12
|
+
/** Size variant */
|
|
13
|
+
size?: ComponentSize;
|
|
14
|
+
/** Additional props for DatePicker component */
|
|
15
|
+
datePickerProps?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* DateFilter wraps the DatePicker component for date filters
|
|
19
|
+
*/
|
|
20
|
+
export declare const DateFilter: React.ForwardRefExoticComponent<DateFilterProps & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export default DateFilter;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
export interface DateRangeFilterProps extends BaseComponentProps {
|
|
4
|
+
/** Filter ID from FilterDefinition */
|
|
5
|
+
filterId: string;
|
|
6
|
+
/** Override label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Show label */
|
|
9
|
+
showLabel?: boolean;
|
|
10
|
+
/** Size variant */
|
|
11
|
+
size?: ComponentSize;
|
|
12
|
+
/** Additional props for DateRangePicker component */
|
|
13
|
+
dateRangePickerProps?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* DateRangeFilter wraps the DateRangePicker component for date range filters
|
|
17
|
+
*/
|
|
18
|
+
export declare const DateRangeFilter: React.ForwardRefExoticComponent<DateRangeFilterProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export default DateRangeFilter;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
export interface ListSelectFilterProps extends BaseComponentProps {
|
|
4
|
+
/** Filter ID from FilterDefinition */
|
|
5
|
+
filterId: string;
|
|
6
|
+
/** Override label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Show label */
|
|
9
|
+
showLabel?: boolean;
|
|
10
|
+
/** Size variant */
|
|
11
|
+
size?: ComponentSize;
|
|
12
|
+
/** Additional props */
|
|
13
|
+
componentProps?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* ListSelectFilter provides a searchable list for selecting one or more items
|
|
17
|
+
*/
|
|
18
|
+
export declare const ListSelectFilter: React.ForwardRefExoticComponent<ListSelectFilterProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
+
export default ListSelectFilter;
|