@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,41 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
import { IconName } from '../Icon/icons';
|
|
4
|
+
export interface TabProps extends Omit<BaseComponentProps, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Value identifier for this tab (required)
|
|
7
|
+
*/
|
|
8
|
+
value: string;
|
|
9
|
+
/**
|
|
10
|
+
* Icon to display before tab label
|
|
11
|
+
*/
|
|
12
|
+
icon?: IconName;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this tab is disabled
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Tab label content
|
|
20
|
+
*/
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Tab component - individual tab header button
|
|
25
|
+
*
|
|
26
|
+
* Must be used within TabList, which must be within Tabs.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Tabs defaultValue="tab1">
|
|
31
|
+
* <TabList>
|
|
32
|
+
* <Tab value="tab1">Tab 1</Tab>
|
|
33
|
+
* <Tab value="tab2" icon="settings">Settings</Tab>
|
|
34
|
+
* </TabList>
|
|
35
|
+
* <TabPanel value="tab1">Content 1</TabPanel>
|
|
36
|
+
* <TabPanel value="tab2">Content 2</TabPanel>
|
|
37
|
+
* </Tabs>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const Tab: React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
export default Tab;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface TabListProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Tab children
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* TabList component - container for Tab items
|
|
11
|
+
*
|
|
12
|
+
* Must be used within Tabs.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Tabs defaultValue="tab1">
|
|
17
|
+
* <TabList>
|
|
18
|
+
* <Tab value="tab1">Tab 1</Tab>
|
|
19
|
+
* <Tab value="tab2">Tab 2</Tab>
|
|
20
|
+
* </TabList>
|
|
21
|
+
* <TabPanel value="tab1">Content 1</TabPanel>
|
|
22
|
+
* <TabPanel value="tab2">Content 2</TabPanel>
|
|
23
|
+
* </Tabs>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export default TabList;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
export interface TabPanelProps extends BaseComponentProps {
|
|
4
|
+
/**
|
|
5
|
+
* Value identifier matching the corresponding Tab
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Panel content
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* TabPanel component - content panel for a tab
|
|
15
|
+
*
|
|
16
|
+
* Must be used within Tabs and paired with a Tab of the same value.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Tabs defaultValue="tab1">
|
|
21
|
+
* <TabList>
|
|
22
|
+
* <Tab value="tab1">Tab 1</Tab>
|
|
23
|
+
* <Tab value="tab2">Tab 2</Tab>
|
|
24
|
+
* </TabList>
|
|
25
|
+
* <TabPanel value="tab1">Content for tab 1</TabPanel>
|
|
26
|
+
* <TabPanel value="tab2">Content for tab 2</TabPanel>
|
|
27
|
+
* </Tabs>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const TabPanel: React.ForwardRefExoticComponent<TabPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export default TabPanel;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
import { TabsVariant } from './TabsContext';
|
|
4
|
+
export interface TabsProps extends Omit<BaseComponentProps, 'onChange'> {
|
|
5
|
+
/**
|
|
6
|
+
* Currently selected tab value (controlled)
|
|
7
|
+
*/
|
|
8
|
+
value?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Default selected tab value (uncontrolled)
|
|
11
|
+
*/
|
|
12
|
+
defaultValue?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when tab selection changes
|
|
15
|
+
* @param value - The newly selected tab value
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (value: string) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Visual variant of the tabs
|
|
20
|
+
* @default 'line'
|
|
21
|
+
*/
|
|
22
|
+
variant?: TabsVariant;
|
|
23
|
+
/**
|
|
24
|
+
* Size of the tabs
|
|
25
|
+
* @default 'md'
|
|
26
|
+
*/
|
|
27
|
+
size?: ComponentSize;
|
|
28
|
+
/**
|
|
29
|
+
* Orientation of the tab list
|
|
30
|
+
* @default 'horizontal'
|
|
31
|
+
*/
|
|
32
|
+
orientation?: 'horizontal' | 'vertical';
|
|
33
|
+
/**
|
|
34
|
+
* Whether tabs are disabled
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether tab panels should be lazy loaded (only render when active)
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
lazyMount?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether to keep inactive panels mounted (with lazyMount)
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
keepMounted?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether tabs should fit container width (distribute equally)
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
fitted?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Tab components (TabList and TabPanels)
|
|
55
|
+
*/
|
|
56
|
+
children: React.ReactNode;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Tabs component - tab navigation with headers and content panels
|
|
60
|
+
*
|
|
61
|
+
* A container component that manages tab selection and provides context
|
|
62
|
+
* to TabList, Tab, and TabPanel children.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* // Basic usage
|
|
67
|
+
* <Tabs defaultValue="tab1">
|
|
68
|
+
* <TabList>
|
|
69
|
+
* <Tab value="tab1">Overview</Tab>
|
|
70
|
+
* <Tab value="tab2">Details</Tab>
|
|
71
|
+
* <Tab value="tab3">Settings</Tab>
|
|
72
|
+
* </TabList>
|
|
73
|
+
* <TabPanel value="tab1">Overview content</TabPanel>
|
|
74
|
+
* <TabPanel value="tab2">Details content</TabPanel>
|
|
75
|
+
* <TabPanel value="tab3">Settings content</TabPanel>
|
|
76
|
+
* </Tabs>
|
|
77
|
+
*
|
|
78
|
+
* // Controlled with icons
|
|
79
|
+
* <Tabs value={activeTab} onChange={setActiveTab} variant="enclosed">
|
|
80
|
+
* <TabList>
|
|
81
|
+
* <Tab value="home" icon="home">Home</Tab>
|
|
82
|
+
* <Tab value="settings" icon="settings">Settings</Tab>
|
|
83
|
+
* </TabList>
|
|
84
|
+
* <TabPanel value="home">Home content</TabPanel>
|
|
85
|
+
* <TabPanel value="settings">Settings content</TabPanel>
|
|
86
|
+
* </Tabs>
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
|
+
export default Tabs;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ComponentSize } from '../../../types';
|
|
2
|
+
export type TabsVariant = 'line' | 'enclosed' | 'soft-rounded' | 'solid-rounded';
|
|
3
|
+
export interface TabsContextValue {
|
|
4
|
+
/**
|
|
5
|
+
* Unique ID for this tabs instance (used to generate deterministic IDs)
|
|
6
|
+
*/
|
|
7
|
+
tabsId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Currently selected tab value
|
|
10
|
+
*/
|
|
11
|
+
selectedValue: string;
|
|
12
|
+
/**
|
|
13
|
+
* Callback when tab selection changes
|
|
14
|
+
*/
|
|
15
|
+
onChange: (value: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Orientation of the tabs
|
|
18
|
+
*/
|
|
19
|
+
orientation: 'horizontal' | 'vertical';
|
|
20
|
+
/**
|
|
21
|
+
* Visual variant of the tabs
|
|
22
|
+
*/
|
|
23
|
+
variant: TabsVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Size of the tabs
|
|
26
|
+
*/
|
|
27
|
+
size: ComponentSize;
|
|
28
|
+
/**
|
|
29
|
+
* Whether all tabs are disabled
|
|
30
|
+
*/
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether tabs should fill container width
|
|
34
|
+
*/
|
|
35
|
+
fitted: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether panels should be lazy mounted
|
|
38
|
+
*/
|
|
39
|
+
lazyMount: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to keep inactive panels mounted
|
|
42
|
+
*/
|
|
43
|
+
keepMounted: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Set of panel values that have been activated at least once
|
|
46
|
+
*/
|
|
47
|
+
activatedPanels: Set<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Mark a panel as having been activated
|
|
50
|
+
*/
|
|
51
|
+
markPanelActivated: (value: string) => void;
|
|
52
|
+
}
|
|
53
|
+
export declare const TabsContext: import('react').Context<TabsContextValue | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Hook to optionally access Tabs context
|
|
56
|
+
* Returns null if not within a Tabs component
|
|
57
|
+
*/
|
|
58
|
+
export declare const useTabsContext: () => TabsContextValue | null;
|
|
59
|
+
/**
|
|
60
|
+
* Hook to access Tabs context
|
|
61
|
+
* @throws Error if used outside of Tabs
|
|
62
|
+
*/
|
|
63
|
+
export declare const useTabsContextStrict: () => TabsContextValue;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { Tabs } from './Tabs';
|
|
2
|
+
export type { TabsProps } from './Tabs';
|
|
3
|
+
export { TabList } from './TabList';
|
|
4
|
+
export type { TabListProps } from './TabList';
|
|
5
|
+
export { Tab } from './Tab';
|
|
6
|
+
export type { TabProps } from './Tab';
|
|
7
|
+
export { TabPanel } from './TabPanel';
|
|
8
|
+
export type { TabPanelProps } from './TabPanel';
|
|
9
|
+
export { TabsContext, useTabsContext, useTabsContextStrict, } from './TabsContext';
|
|
10
|
+
export type { TabsContextValue, TabsVariant } from './TabsContext';
|
|
11
|
+
export { default } from './Tabs';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PopoverPosition } from '../../../utils/positioning';
|
|
3
|
+
import { BaseComponentProps } from '../../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the TruncatedList component
|
|
6
|
+
*/
|
|
7
|
+
export interface TruncatedListProps<T> extends Omit<BaseComponentProps, 'children'> {
|
|
8
|
+
/**
|
|
9
|
+
* Items to display
|
|
10
|
+
*/
|
|
11
|
+
items: T[];
|
|
12
|
+
/**
|
|
13
|
+
* Maximum number of visible items before truncation
|
|
14
|
+
* @default 3
|
|
15
|
+
*/
|
|
16
|
+
maxVisible?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Render function for each visible item
|
|
19
|
+
*/
|
|
20
|
+
renderItem: (item: T, index: number) => React.ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Render function for the "+N more" indicator
|
|
23
|
+
* If not provided, uses default indicator
|
|
24
|
+
*/
|
|
25
|
+
renderMore?: (count: number, hiddenItems: T[]) => React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Gap between items (px)
|
|
28
|
+
* @default 8
|
|
29
|
+
*/
|
|
30
|
+
gap?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Direction of the list
|
|
33
|
+
* @default 'horizontal'
|
|
34
|
+
*/
|
|
35
|
+
direction?: 'horizontal' | 'vertical';
|
|
36
|
+
/**
|
|
37
|
+
* Show hidden items in a tooltip on hover
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
showTooltip?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Custom tooltip content for hidden items
|
|
43
|
+
* If not provided, uses renderItem for each hidden item
|
|
44
|
+
*/
|
|
45
|
+
tooltipContent?: (hiddenItems: T[]) => React.ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Tooltip position
|
|
48
|
+
* @default 'top'
|
|
49
|
+
*/
|
|
50
|
+
tooltipPosition?: PopoverPosition;
|
|
51
|
+
/**
|
|
52
|
+
* Maximum width of the tooltip
|
|
53
|
+
* @default 300
|
|
54
|
+
*/
|
|
55
|
+
tooltipMaxWidth?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Callback when the "more" indicator is clicked
|
|
58
|
+
*/
|
|
59
|
+
onMoreClick?: (hiddenItems: T[]) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Custom key extractor for items
|
|
62
|
+
* @default (item, index) => index
|
|
63
|
+
*/
|
|
64
|
+
keyExtractor?: (item: T, index: number) => string | number;
|
|
65
|
+
}
|
|
66
|
+
export declare const TruncatedList: <T>(props: TruncatedListProps<T> & {
|
|
67
|
+
ref?: React.ForwardedRef<HTMLDivElement>;
|
|
68
|
+
}) => React.ReactElement;
|
|
69
|
+
export default TruncatedList;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DnD context for sharing drag state across components
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Data attached to a draggable item
|
|
6
|
+
*/
|
|
7
|
+
export interface DragData {
|
|
8
|
+
/** Unique identifier */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Item type for filtering drop targets */
|
|
11
|
+
type?: string;
|
|
12
|
+
/** Index in list (for sortable) */
|
|
13
|
+
index?: number;
|
|
14
|
+
/** Additional custom data */
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Active drag state
|
|
19
|
+
*/
|
|
20
|
+
export interface ActiveDrag {
|
|
21
|
+
/** ID of the dragged item */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Data attached to the dragged item */
|
|
24
|
+
data: DragData;
|
|
25
|
+
/** Element being dragged */
|
|
26
|
+
element: HTMLElement | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* DnD context value
|
|
30
|
+
*/
|
|
31
|
+
export interface DndContextValue {
|
|
32
|
+
/** Currently active drag, null if nothing is being dragged */
|
|
33
|
+
active: ActiveDrag | null;
|
|
34
|
+
/** ID of the element currently being dragged over */
|
|
35
|
+
overId: string | null;
|
|
36
|
+
/** Data of the element currently being dragged over */
|
|
37
|
+
overData: DragData | null;
|
|
38
|
+
/** Set active drag state */
|
|
39
|
+
setActive: (active: ActiveDrag | null) => void;
|
|
40
|
+
/** Set over state */
|
|
41
|
+
setOver: (id: string | null, data: DragData | null) => void;
|
|
42
|
+
/** Register a droppable and return unregister function */
|
|
43
|
+
registerDroppable: (id: string, data: DragData) => () => void;
|
|
44
|
+
/** Get all registered droppables */
|
|
45
|
+
getDroppables: () => Map<string, DragData>;
|
|
46
|
+
/** Drag end callback */
|
|
47
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Event fired when drag ends
|
|
51
|
+
*/
|
|
52
|
+
export interface DragEndEvent {
|
|
53
|
+
/** The dragged item */
|
|
54
|
+
active: ActiveDrag;
|
|
55
|
+
/** The drop target, null if dropped outside */
|
|
56
|
+
over: {
|
|
57
|
+
id: string;
|
|
58
|
+
data: DragData;
|
|
59
|
+
} | null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Event fired when drag starts
|
|
63
|
+
*/
|
|
64
|
+
export interface DragStartEvent {
|
|
65
|
+
/** The dragged item */
|
|
66
|
+
active: ActiveDrag;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Event fired when dragging over a droppable
|
|
70
|
+
*/
|
|
71
|
+
export interface DragOverEvent {
|
|
72
|
+
/** The dragged item */
|
|
73
|
+
active: ActiveDrag;
|
|
74
|
+
/** The element being dragged over */
|
|
75
|
+
over: {
|
|
76
|
+
id: string;
|
|
77
|
+
data: DragData;
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* DnD context
|
|
82
|
+
*/
|
|
83
|
+
export declare const DndContext: import('react').Context<DndContextValue | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Hook to access DnD context (throws if not in provider)
|
|
86
|
+
*/
|
|
87
|
+
export declare function useDndContext(): DndContextValue;
|
|
88
|
+
/**
|
|
89
|
+
* Hook to access DnD context (returns null if not in provider)
|
|
90
|
+
*/
|
|
91
|
+
export declare function useDndContextOptional(): DndContextValue | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { DragEndEvent, DragStartEvent, DragOverEvent } from './DndContext';
|
|
3
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
4
|
+
export interface DndProviderProps extends Omit<BaseComponentProps, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Children components
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* Callback when drag starts
|
|
11
|
+
*/
|
|
12
|
+
onDragStart?: (event: DragStartEvent) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Callback when dragging over a droppable
|
|
15
|
+
*/
|
|
16
|
+
onDragOver?: (event: DragOverEvent) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Callback when drag ends
|
|
19
|
+
*/
|
|
20
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Callback when drag is cancelled
|
|
23
|
+
*/
|
|
24
|
+
onDragCancel?: (event: DragStartEvent) => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* DndProvider component that wraps the application to enable drag and drop
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <DndProvider onDragEnd={handleDragEnd}>
|
|
32
|
+
* <SortableList items={items} onReorder={setItems} />
|
|
33
|
+
* </DndProvider>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const DndProvider: React.FC<DndProviderProps>;
|
|
37
|
+
export default DndProvider;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { DndProvider, type DndProviderProps } from './DndProvider';
|
|
2
|
+
export { DndContext, useDndContext, useDndContextOptional, type DndContextValue, type ActiveDrag, type DragData, type DragEndEvent, type DragStartEvent, type DragOverEvent, } from './DndContext';
|
|
3
|
+
export { default } from './DndProvider';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { default as React, CSSProperties } from 'react';
|
|
2
|
+
import { BaseComponentProps, ExtendedComponentSize } from '../../../types/component.types';
|
|
3
|
+
export interface DragHandleProps extends Omit<BaseComponentProps, 'children'>, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'style'> {
|
|
4
|
+
/**
|
|
5
|
+
* Size of the handle
|
|
6
|
+
* @default 'md'
|
|
7
|
+
*/
|
|
8
|
+
size?: ExtendedComponentSize;
|
|
9
|
+
/**
|
|
10
|
+
* Visual variant
|
|
11
|
+
* @default 'dots'
|
|
12
|
+
*/
|
|
13
|
+
variant?: 'dots' | 'lines' | 'grip';
|
|
14
|
+
/**
|
|
15
|
+
* Whether handle is disabled
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Accessible label
|
|
21
|
+
* @default 'Drag handle'
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Custom styles
|
|
26
|
+
*/
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* DragHandle component for drag and drop interactions
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <SortableItem>
|
|
35
|
+
* <DragHandle {...dragHandleProps} />
|
|
36
|
+
* <span>Item content</span>
|
|
37
|
+
* </SortableItem>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const DragHandle: React.ForwardRefExoticComponent<DragHandleProps & React.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
export default DragHandle;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types/component.types';
|
|
3
|
+
export interface DragOverlayProps extends Omit<BaseComponentProps, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* Content to render in the overlay
|
|
6
|
+
* Can be a render function that receives the active drag data
|
|
7
|
+
*/
|
|
8
|
+
children?: ReactNode | ((activeId: string, activeData: Record<string, unknown>) => ReactNode);
|
|
9
|
+
/**
|
|
10
|
+
* Whether to adjust position with scroll
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
adjustScale?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Drop animation duration in ms (0 to disable)
|
|
16
|
+
* @default 200
|
|
17
|
+
*/
|
|
18
|
+
dropAnimationDuration?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Z-index for the overlay
|
|
21
|
+
* @default 9999
|
|
22
|
+
*/
|
|
23
|
+
zIndex?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* DragOverlay component that renders a visual clone during drag operations
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <DndProvider>
|
|
31
|
+
* <SortableList items={items} />
|
|
32
|
+
* <DragOverlay>
|
|
33
|
+
* {(activeId, data) => <Card>{data.title}</Card>}
|
|
34
|
+
* </DragOverlay>
|
|
35
|
+
* </DndProvider>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare const DragOverlay: React.FC<DragOverlayProps>;
|
|
39
|
+
export default DragOverlay;
|