@true-tech-team/react-components 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/index.css +1 -1
- package/index.d.ts +12 -0
- package/index.js +1 -1
- package/index.mjs +10774 -5477
- package/lib/components/buttons/Button/Button.d.ts +14 -3
- 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/Accordion/Accordion.d.ts +112 -0
- package/lib/components/display/Accordion/AccordionContainer.d.ts +101 -0
- package/lib/components/display/Accordion/AccordionContext.d.ts +57 -0
- package/lib/components/display/Accordion/index.d.ts +6 -0
- package/lib/components/display/Avatar/Avatar.d.ts +1 -1
- package/lib/components/display/Card/Card.d.ts +101 -0
- package/lib/components/display/Card/index.d.ts +3 -0
- package/lib/components/display/Carousel/Carousel.d.ts +125 -0
- package/lib/components/display/Carousel/index.d.ts +3 -0
- package/lib/components/display/Collapse/Collapse.d.ts +57 -0
- package/lib/components/display/Collapse/index.d.ts +2 -0
- package/lib/components/display/CountUp/CountUp.d.ts +119 -0
- package/lib/components/display/CountUp/index.d.ts +3 -0
- package/lib/components/display/FlipCard/FlipCard.d.ts +125 -0
- package/lib/components/display/FlipCard/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/Icon/index.d.ts +1 -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/PageMessages/PageMessageContent.d.ts +19 -0
- package/lib/components/display/PageMessages/PageMessages.d.ts +49 -0
- package/lib/components/display/PageMessages/defaultConfigs.d.ts +5 -0
- package/lib/components/display/PageMessages/index.d.ts +3 -0
- package/lib/components/display/PageMessages/types.d.ts +175 -0
- package/lib/components/display/ProgressBar/ProgressBar.d.ts +11 -0
- package/lib/components/display/Reveal/Reveal.d.ts +109 -0
- package/lib/components/display/Reveal/index.d.ts +3 -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/Spinner/Spinner.d.ts +79 -0
- package/lib/components/display/Spinner/index.d.ts +3 -0
- package/lib/components/display/StatusIndicator/StatusIndicator.d.ts +1 -1
- 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 +3 -0
- package/lib/components/index.d.ts +65 -0
- 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/Toggle/Toggle.d.ts +5 -0
- 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/LoadingOverlay/LoadingOverlay.d.ts +101 -0
- package/lib/components/overlays/LoadingOverlay/index.d.ts +3 -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/contexts/PageMessagesContext/PageMessagesContext.d.ts +91 -0
- package/lib/contexts/PageMessagesContext/index.d.ts +2 -0
- package/lib/contexts/index.d.ts +2 -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 +21 -1
- package/package.json +1 -1
|
@@ -41,9 +41,20 @@ export interface ButtonProps extends BaseComponentProps {
|
|
|
41
41
|
* Can be an icon name or a React component
|
|
42
42
|
*/
|
|
43
43
|
endIcon?: React.ReactNode | IconName;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the button is in loading state
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
loading?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Text to display while loading (replaces children)
|
|
51
|
+
*/
|
|
52
|
+
loadingText?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Position of the loading spinner
|
|
55
|
+
* @default 'start'
|
|
56
|
+
*/
|
|
57
|
+
loadingPosition?: 'start' | 'end' | 'center';
|
|
44
58
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Button component with multiple variants and sizes
|
|
47
|
-
*/
|
|
48
59
|
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
49
60
|
export default Button;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize, ComponentVariant } from '../../../types';
|
|
3
|
+
export interface ButtonToggleGroupProps extends Omit<BaseComponentProps, 'onChange'> {
|
|
4
|
+
/**
|
|
5
|
+
* Currently selected value (controlled)
|
|
6
|
+
*/
|
|
7
|
+
value?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Default selected value (uncontrolled)
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Callback when selection changes
|
|
14
|
+
* @param value - The newly selected value
|
|
15
|
+
* @param event - The click event
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (value: string, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Variant style for all buttons
|
|
20
|
+
* @default 'outline'
|
|
21
|
+
*/
|
|
22
|
+
variant?: ComponentVariant;
|
|
23
|
+
/**
|
|
24
|
+
* Size for all buttons
|
|
25
|
+
* @default 'md'
|
|
26
|
+
*/
|
|
27
|
+
size?: ComponentSize;
|
|
28
|
+
/**
|
|
29
|
+
* Orientation of the button group
|
|
30
|
+
* @default 'horizontal'
|
|
31
|
+
*/
|
|
32
|
+
orientation?: 'horizontal' | 'vertical';
|
|
33
|
+
/**
|
|
34
|
+
* Whether buttons should take full width (distribute equally)
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether all buttons are disabled
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Group label for accessibility
|
|
45
|
+
*/
|
|
46
|
+
'aria-label'?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Name attribute for form submission
|
|
49
|
+
*/
|
|
50
|
+
name?: string;
|
|
51
|
+
/**
|
|
52
|
+
* ButtonToggleGroupItem children
|
|
53
|
+
*/
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* ButtonToggleGroup component - a group of buttons with single selection
|
|
58
|
+
*
|
|
59
|
+
* A segmented control that allows selecting one option from a group of buttons.
|
|
60
|
+
* Buttons can contain icons, text, or both.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* // Text buttons
|
|
65
|
+
* <ButtonToggleGroup value={size} onChange={setSize}>
|
|
66
|
+
* <ButtonToggleGroupItem value="sm">Small</ButtonToggleGroupItem>
|
|
67
|
+
* <ButtonToggleGroupItem value="md">Medium</ButtonToggleGroupItem>
|
|
68
|
+
* <ButtonToggleGroupItem value="lg">Large</ButtonToggleGroupItem>
|
|
69
|
+
* </ButtonToggleGroup>
|
|
70
|
+
*
|
|
71
|
+
* // Icon buttons
|
|
72
|
+
* <ButtonToggleGroup value={view} onChange={setView}>
|
|
73
|
+
* <ButtonToggleGroupItem value="list" icon="list" />
|
|
74
|
+
* <ButtonToggleGroupItem value="grid" icon="grid" />
|
|
75
|
+
* </ButtonToggleGroup>
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const ButtonToggleGroup: React.ForwardRefExoticComponent<ButtonToggleGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
79
|
+
export default ButtonToggleGroup;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ComponentSize, ComponentVariant } from '../../../types';
|
|
2
|
+
export interface ButtonToggleGroupContextValue {
|
|
3
|
+
/**
|
|
4
|
+
* Group name for form submission
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* Currently selected value
|
|
9
|
+
*/
|
|
10
|
+
value?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when selection changes
|
|
13
|
+
*/
|
|
14
|
+
onChange?: (value: string, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the group is disabled
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Size for all items
|
|
21
|
+
*/
|
|
22
|
+
size?: ComponentSize;
|
|
23
|
+
/**
|
|
24
|
+
* Variant style for all items
|
|
25
|
+
*/
|
|
26
|
+
variant?: ComponentVariant;
|
|
27
|
+
}
|
|
28
|
+
export declare const ButtonToggleGroupContext: import('react').Context<ButtonToggleGroupContextValue | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Hook to access ButtonToggleGroup context
|
|
31
|
+
* @throws Error if used outside of ButtonToggleGroup
|
|
32
|
+
*/
|
|
33
|
+
export declare const useButtonToggleGroup: () => ButtonToggleGroupContextValue;
|
|
34
|
+
/**
|
|
35
|
+
* Hook to optionally access ButtonToggleGroup context
|
|
36
|
+
* Returns null if not within a ButtonToggleGroup
|
|
37
|
+
*/
|
|
38
|
+
export declare const useButtonToggleGroupOptional: () => ButtonToggleGroupContextValue | null;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps } from '../../../types';
|
|
3
|
+
import { IconName } from '../../display/Icon/icons';
|
|
4
|
+
export interface ButtonToggleGroupItemProps extends Omit<BaseComponentProps, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Value for this item (required for selection)
|
|
7
|
+
*/
|
|
8
|
+
value: string;
|
|
9
|
+
/**
|
|
10
|
+
* Icon to display (can be used with or without children)
|
|
11
|
+
*/
|
|
12
|
+
icon?: IconName;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this specific item is disabled
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Button content (text label)
|
|
20
|
+
*/
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* ButtonToggleGroupItem component - individual button within a ButtonToggleGroup
|
|
25
|
+
*
|
|
26
|
+
* Must be used as a child of ButtonToggleGroup.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <ButtonToggleGroup value={view} onChange={setView}>
|
|
31
|
+
* <ButtonToggleGroupItem value="list" icon="list">List</ButtonToggleGroupItem>
|
|
32
|
+
* <ButtonToggleGroupItem value="grid" icon="grid">Grid</ButtonToggleGroupItem>
|
|
33
|
+
* </ButtonToggleGroup>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const ButtonToggleGroupItem: React.ForwardRefExoticComponent<ButtonToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
37
|
+
export default ButtonToggleGroupItem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ButtonToggleGroup } from './ButtonToggleGroup';
|
|
2
|
+
export type { ButtonToggleGroupProps } from './ButtonToggleGroup';
|
|
3
|
+
export { ButtonToggleGroupItem } from './ButtonToggleGroupItem';
|
|
4
|
+
export type { ButtonToggleGroupItemProps } from './ButtonToggleGroupItem';
|
|
5
|
+
export { ButtonToggleGroupContext, useButtonToggleGroup, useButtonToggleGroupOptional, } from './ButtonToggleGroupContext';
|
|
6
|
+
export type { ButtonToggleGroupContextValue } from './ButtonToggleGroupContext';
|
|
7
|
+
export { default } from './ButtonToggleGroup';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseComponentProps, ExtendedComponentSize } from '../../../types';
|
|
3
|
+
import { IconName } from '../../display/Icon/icons';
|
|
4
|
+
export interface ToggleButtonProps extends Omit<BaseComponentProps, 'children'> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the toggle button is in active state (controlled)
|
|
7
|
+
*/
|
|
8
|
+
active?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Default active state for uncontrolled component
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
defaultActive?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Callback fired when active state changes
|
|
16
|
+
* @param active - The new active state
|
|
17
|
+
* @param event - The click event
|
|
18
|
+
*/
|
|
19
|
+
onChange?: (active: boolean, event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Icon to display when active (filled icon recommended)
|
|
22
|
+
* @default 'heart-filled'
|
|
23
|
+
*/
|
|
24
|
+
activeIcon?: IconName;
|
|
25
|
+
/**
|
|
26
|
+
* Icon to display when inactive (outline icon recommended)
|
|
27
|
+
* @default 'heart'
|
|
28
|
+
*/
|
|
29
|
+
inactiveIcon?: IconName;
|
|
30
|
+
/**
|
|
31
|
+
* Button size
|
|
32
|
+
* @default 'md'
|
|
33
|
+
*/
|
|
34
|
+
size?: ExtendedComponentSize;
|
|
35
|
+
/**
|
|
36
|
+
* Color when active
|
|
37
|
+
* @default 'var(--theme-error)'
|
|
38
|
+
*/
|
|
39
|
+
activeColor?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Color when inactive
|
|
42
|
+
* @default 'var(--theme-text-secondary)'
|
|
43
|
+
*/
|
|
44
|
+
inactiveColor?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the button is disabled
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Button type attribute
|
|
52
|
+
* @default 'button'
|
|
53
|
+
*/
|
|
54
|
+
type?: 'button' | 'submit' | 'reset';
|
|
55
|
+
/**
|
|
56
|
+
* Whether to show animation on toggle
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
animated?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Accessible label (REQUIRED for icon-only buttons)
|
|
62
|
+
*/
|
|
63
|
+
'aria-label': string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* ToggleButton component - an icon button that toggles between two states
|
|
67
|
+
*
|
|
68
|
+
* A versatile toggle button that displays different icons for active/inactive states.
|
|
69
|
+
* Perfect for like buttons, favorites, bookmarks, and similar toggle interactions.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* // Like button (default)
|
|
74
|
+
* <ToggleButton aria-label="Like" onChange={(liked) => console.log(liked)} />
|
|
75
|
+
*
|
|
76
|
+
* // Controlled bookmark button
|
|
77
|
+
* <ToggleButton
|
|
78
|
+
* active={isBookmarked}
|
|
79
|
+
* onChange={setIsBookmarked}
|
|
80
|
+
* activeIcon="bookmark"
|
|
81
|
+
* inactiveIcon="bookmark"
|
|
82
|
+
* activeColor="var(--theme-primary)"
|
|
83
|
+
* aria-label="Bookmark"
|
|
84
|
+
* />
|
|
85
|
+
*
|
|
86
|
+
* // Star favorite button
|
|
87
|
+
* <ToggleButton
|
|
88
|
+
* activeIcon="star"
|
|
89
|
+
* inactiveIcon="star"
|
|
90
|
+
* activeColor="var(--theme-warning)"
|
|
91
|
+
* aria-label="Favorite"
|
|
92
|
+
* />
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare const ToggleButton: React.ForwardRefExoticComponent<ToggleButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
96
|
+
export default ToggleButton;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
import { IconName } from '../../display/Icon/icons';
|
|
4
|
+
/**
|
|
5
|
+
* Position of the expand/collapse icon
|
|
6
|
+
*/
|
|
7
|
+
export type AccordionIconPosition = 'left' | 'right';
|
|
8
|
+
export interface AccordionProps extends BaseComponentProps {
|
|
9
|
+
/**
|
|
10
|
+
* Unique identifier for the accordion
|
|
11
|
+
* Required when used within AccordionContainer
|
|
12
|
+
*/
|
|
13
|
+
id?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Header content (can be string or ReactNode)
|
|
16
|
+
*/
|
|
17
|
+
header: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Accordion body content
|
|
20
|
+
*/
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the accordion is expanded (controlled)
|
|
24
|
+
*/
|
|
25
|
+
isOpen?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Default expanded state (uncontrolled)
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
defaultOpen?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Callback when open state changes
|
|
33
|
+
* @param isOpen - The new open state
|
|
34
|
+
*/
|
|
35
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Position of the expand/collapse icon
|
|
38
|
+
* @default 'right'
|
|
39
|
+
*/
|
|
40
|
+
iconPosition?: AccordionIconPosition;
|
|
41
|
+
/**
|
|
42
|
+
* Custom expand icon (icon name or ReactNode)
|
|
43
|
+
* @default 'chevron-down'
|
|
44
|
+
*/
|
|
45
|
+
expandIcon?: IconName | ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* Custom collapse icon (icon name or ReactNode)
|
|
48
|
+
* If not provided, expandIcon will rotate 180deg
|
|
49
|
+
*/
|
|
50
|
+
collapseIcon?: IconName | ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to disable the accordion
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Accordion size variant
|
|
58
|
+
* @default 'md'
|
|
59
|
+
*/
|
|
60
|
+
size?: ComponentSize;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to show border around the accordion
|
|
63
|
+
* @default true
|
|
64
|
+
*/
|
|
65
|
+
bordered?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Animation duration in milliseconds
|
|
68
|
+
* @default 250
|
|
69
|
+
*/
|
|
70
|
+
animationDuration?: number;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to unmount body content when collapsed
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
unmountOnCollapse?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Additional header icon (shown before header text)
|
|
78
|
+
*/
|
|
79
|
+
headerIcon?: IconName | ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* Callback when header is clicked
|
|
82
|
+
*/
|
|
83
|
+
onHeaderClick?: () => void;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Accordion component
|
|
87
|
+
* A collapsible panel with a clickable header and expandable body
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* // Standalone usage
|
|
92
|
+
* <Accordion header="Section Title">
|
|
93
|
+
* <p>Section content here</p>
|
|
94
|
+
* </Accordion>
|
|
95
|
+
*
|
|
96
|
+
* // With custom icon position
|
|
97
|
+
* <Accordion header="Settings" iconPosition="left">
|
|
98
|
+
* <p>Settings content</p>
|
|
99
|
+
* </Accordion>
|
|
100
|
+
*
|
|
101
|
+
* // Controlled
|
|
102
|
+
* <Accordion
|
|
103
|
+
* header="Details"
|
|
104
|
+
* isOpen={isExpanded}
|
|
105
|
+
* onOpenChange={setIsExpanded}
|
|
106
|
+
* >
|
|
107
|
+
* <p>Details content</p>
|
|
108
|
+
* </Accordion>
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare const Accordion: import('react').ForwardRefExoticComponent<AccordionProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
112
|
+
export default Accordion;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types';
|
|
3
|
+
import { AccordionMode } from './AccordionContext';
|
|
4
|
+
/**
|
|
5
|
+
* Position of the expand/collapse all controls
|
|
6
|
+
*/
|
|
7
|
+
export type AccordionControlsPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
8
|
+
export interface AccordionContainerProps extends Omit<BaseComponentProps, 'children'> {
|
|
9
|
+
/**
|
|
10
|
+
* Accordion children
|
|
11
|
+
*/
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Mode for accordion expansion
|
|
15
|
+
* - 'single': Only one accordion can be open at a time
|
|
16
|
+
* - 'multiple': Multiple accordions can be open simultaneously
|
|
17
|
+
* @default 'multiple'
|
|
18
|
+
*/
|
|
19
|
+
mode?: AccordionMode;
|
|
20
|
+
/**
|
|
21
|
+
* Array of expanded accordion IDs (controlled)
|
|
22
|
+
*/
|
|
23
|
+
expandedIds?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* Default expanded accordion IDs (uncontrolled)
|
|
26
|
+
* @default []
|
|
27
|
+
*/
|
|
28
|
+
defaultExpandedIds?: string[];
|
|
29
|
+
/**
|
|
30
|
+
* Callback when expanded IDs change
|
|
31
|
+
* @param expandedIds - Array of currently expanded accordion IDs
|
|
32
|
+
*/
|
|
33
|
+
onExpandedChange?: (expandedIds: string[]) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to show expand all / collapse all controls
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
showExpandAllControls?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Label for "Expand All" button
|
|
41
|
+
* @default 'Expand All'
|
|
42
|
+
*/
|
|
43
|
+
expandAllLabel?: ReactNode;
|
|
44
|
+
/**
|
|
45
|
+
* Label for "Collapse All" button
|
|
46
|
+
* @default 'Collapse All'
|
|
47
|
+
*/
|
|
48
|
+
collapseAllLabel?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Position of expand/collapse all controls
|
|
51
|
+
* @default 'top-right'
|
|
52
|
+
*/
|
|
53
|
+
controlsPosition?: AccordionControlsPosition;
|
|
54
|
+
/**
|
|
55
|
+
* Size variant for all accordions (can be overridden per accordion)
|
|
56
|
+
* @default 'md'
|
|
57
|
+
*/
|
|
58
|
+
size?: ComponentSize;
|
|
59
|
+
/**
|
|
60
|
+
* Gap between accordions in pixels
|
|
61
|
+
* @default 8
|
|
62
|
+
*/
|
|
63
|
+
gap?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Whether accordions should be bordered
|
|
66
|
+
* @default true
|
|
67
|
+
*/
|
|
68
|
+
bordered?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Whether to disable all accordions
|
|
71
|
+
* @default false
|
|
72
|
+
*/
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* AccordionContainer component
|
|
77
|
+
* Manages multiple accordions with optional expand/collapse all functionality
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // Basic usage
|
|
82
|
+
* <AccordionContainer>
|
|
83
|
+
* <Accordion id="section1" header="Section 1">Content 1</Accordion>
|
|
84
|
+
* <Accordion id="section2" header="Section 2">Content 2</Accordion>
|
|
85
|
+
* </AccordionContainer>
|
|
86
|
+
*
|
|
87
|
+
* // With expand/collapse all
|
|
88
|
+
* <AccordionContainer showExpandAllControls>
|
|
89
|
+
* <Accordion id="section1" header="Section 1">Content 1</Accordion>
|
|
90
|
+
* <Accordion id="section2" header="Section 2">Content 2</Accordion>
|
|
91
|
+
* </AccordionContainer>
|
|
92
|
+
*
|
|
93
|
+
* // Single mode (only one open at a time)
|
|
94
|
+
* <AccordionContainer mode="single">
|
|
95
|
+
* <Accordion id="section1" header="Section 1">Content 1</Accordion>
|
|
96
|
+
* <Accordion id="section2" header="Section 2">Content 2</Accordion>
|
|
97
|
+
* </AccordionContainer>
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare const AccordionContainer: React.FC<AccordionContainerProps>;
|
|
101
|
+
export default AccordionContainer;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ComponentSize } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Accordion expansion mode
|
|
4
|
+
* - 'single': Only one accordion can be open at a time
|
|
5
|
+
* - 'multiple': Multiple accordions can be open simultaneously
|
|
6
|
+
*/
|
|
7
|
+
export type AccordionMode = 'single' | 'multiple';
|
|
8
|
+
/**
|
|
9
|
+
* Context value for AccordionContainer
|
|
10
|
+
*/
|
|
11
|
+
export interface AccordionContextValue {
|
|
12
|
+
/**
|
|
13
|
+
* Set of expanded accordion IDs
|
|
14
|
+
*/
|
|
15
|
+
expandedIds: Set<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Toggle expansion state of an accordion
|
|
18
|
+
* @param id - The accordion ID to toggle
|
|
19
|
+
*/
|
|
20
|
+
toggleAccordion: (id: string) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Expansion mode
|
|
23
|
+
*/
|
|
24
|
+
mode: AccordionMode;
|
|
25
|
+
/**
|
|
26
|
+
* Whether all accordions in the container are disabled
|
|
27
|
+
*/
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Size variant from container (can be overridden per accordion)
|
|
31
|
+
*/
|
|
32
|
+
size?: ComponentSize;
|
|
33
|
+
/**
|
|
34
|
+
* Whether accordions should show borders
|
|
35
|
+
*/
|
|
36
|
+
bordered?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Accordion context
|
|
40
|
+
* Provides state coordination for AccordionContainer
|
|
41
|
+
*/
|
|
42
|
+
export declare const AccordionContext: import('react').Context<AccordionContextValue | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Hook to access accordion container context
|
|
45
|
+
* Returns null if not within AccordionContainer (allowing standalone usage)
|
|
46
|
+
*
|
|
47
|
+
* @returns AccordionContextValue or null if outside container
|
|
48
|
+
*/
|
|
49
|
+
export declare function useAccordionContext(): AccordionContextValue | null;
|
|
50
|
+
/**
|
|
51
|
+
* Hook that throws if not within AccordionContainer
|
|
52
|
+
* Use this when accordion must be within a container
|
|
53
|
+
*
|
|
54
|
+
* @throws Error if used outside AccordionContainer
|
|
55
|
+
* @returns AccordionContextValue
|
|
56
|
+
*/
|
|
57
|
+
export declare function useAccordionContextStrict(): AccordionContextValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Accordion, default } from './Accordion';
|
|
2
|
+
export type { AccordionProps, AccordionIconPosition } from './Accordion';
|
|
3
|
+
export { AccordionContainer } from './AccordionContainer';
|
|
4
|
+
export type { AccordionContainerProps, AccordionControlsPosition } from './AccordionContainer';
|
|
5
|
+
export { AccordionContext, useAccordionContext, useAccordionContextStrict } from './AccordionContext';
|
|
6
|
+
export type { AccordionContextValue, AccordionMode } from './AccordionContext';
|
|
@@ -35,7 +35,7 @@ export interface AvatarProps extends Omit<BaseComponentProps, 'children'> {
|
|
|
35
35
|
/**
|
|
36
36
|
* Status indicator
|
|
37
37
|
*/
|
|
38
|
-
status?: 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'processing';
|
|
38
|
+
status?: 'online' | 'offline' | 'away' | 'busy' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'processing';
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Avatar - User profile picture or placeholder with initials/fallback
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { default as React, ReactNode, MouseEvent } from 'react';
|
|
2
|
+
import { BaseComponentProps, ComponentSize } from '../../../types/component.types';
|
|
3
|
+
/**
|
|
4
|
+
* Card visual variants
|
|
5
|
+
*/
|
|
6
|
+
export type CardVariant = 'outlined' | 'elevated' | 'filled';
|
|
7
|
+
/**
|
|
8
|
+
* Card padding options
|
|
9
|
+
*/
|
|
10
|
+
export type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
11
|
+
/**
|
|
12
|
+
* Props for the Card component
|
|
13
|
+
*/
|
|
14
|
+
export interface CardProps extends BaseComponentProps {
|
|
15
|
+
/**
|
|
16
|
+
* Visual variant of the card
|
|
17
|
+
* @default 'outlined'
|
|
18
|
+
*/
|
|
19
|
+
variant?: CardVariant;
|
|
20
|
+
/**
|
|
21
|
+
* Size of the card (affects border-radius)
|
|
22
|
+
* @default 'md'
|
|
23
|
+
*/
|
|
24
|
+
size?: ComponentSize;
|
|
25
|
+
/**
|
|
26
|
+
* Padding inside the card
|
|
27
|
+
* @default 'md'
|
|
28
|
+
*/
|
|
29
|
+
padding?: CardPadding;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the card is interactive (clickable)
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
interactive?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the card is disabled
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Click handler (when interactive)
|
|
42
|
+
*/
|
|
43
|
+
onClick?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Optional header content
|
|
46
|
+
*/
|
|
47
|
+
header?: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Optional footer content
|
|
50
|
+
*/
|
|
51
|
+
footer?: ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the header has a bottom divider
|
|
54
|
+
* @default true (when header is provided)
|
|
55
|
+
*/
|
|
56
|
+
headerDivider?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Whether the footer has a top divider
|
|
59
|
+
* @default true (when footer is provided)
|
|
60
|
+
*/
|
|
61
|
+
footerDivider?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to show hover effect (auto-enabled when interactive)
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
hoverable?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the card takes full width
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
fullWidth?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Card - A flexible container component for grouping related content
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```tsx
|
|
78
|
+
* <Card variant="outlined" padding="md">
|
|
79
|
+
* Card content goes here
|
|
80
|
+
* </Card>
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* <Card
|
|
86
|
+
* header={<h3>Card Title</h3>}
|
|
87
|
+
* footer={<Button>Action</Button>}
|
|
88
|
+
* >
|
|
89
|
+
* Main content
|
|
90
|
+
* </Card>
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```tsx
|
|
95
|
+
* <Card interactive onClick={() => console.log('clicked')}>
|
|
96
|
+
* Clickable card
|
|
97
|
+
* </Card>
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
export declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
101
|
+
export default Card;
|