@appforgeapps/uiforge 0.5.0 → 0.5.2
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 +512 -1
- package/dist/index.d.ts +426 -2
- package/dist/uiforge.cjs +5 -5
- package/dist/uiforge.css +1 -1
- package/dist/uiforge.js +2246 -1464
- package/package.json +5 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
2
|
import { FC } from 'react';
|
|
3
3
|
import { JSX } from 'react/jsx-runtime';
|
|
4
|
+
import { RefObject } from 'react';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Represents a single activity/event in the stream
|
|
@@ -62,6 +63,67 @@ export declare const ActivityIcons: {
|
|
|
62
63
|
deploy: FC<IconProps>;
|
|
63
64
|
};
|
|
64
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Context for passing density and showMeta settings from ActivityStream to ActivityItem
|
|
68
|
+
*/
|
|
69
|
+
export declare interface ActivityItemContextValue {
|
|
70
|
+
/**
|
|
71
|
+
* Density mode for the item
|
|
72
|
+
*/
|
|
73
|
+
density: ActivityStreamDensity;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to show metadata (timestamps, descriptions, etc.)
|
|
76
|
+
*/
|
|
77
|
+
showMeta: boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Represents a single activity/event item
|
|
82
|
+
*/
|
|
83
|
+
export declare interface ActivityItemEvent {
|
|
84
|
+
/**
|
|
85
|
+
* Unique identifier for the event
|
|
86
|
+
*/
|
|
87
|
+
id: string | number;
|
|
88
|
+
/**
|
|
89
|
+
* Type/category of the event (e.g., 'commit', 'issue', 'pr', 'comment')
|
|
90
|
+
*/
|
|
91
|
+
type: string;
|
|
92
|
+
/**
|
|
93
|
+
* Display title for the event
|
|
94
|
+
*/
|
|
95
|
+
title: string;
|
|
96
|
+
/**
|
|
97
|
+
* Optional description or content
|
|
98
|
+
*/
|
|
99
|
+
description?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Timestamp of the event
|
|
102
|
+
*/
|
|
103
|
+
timestamp: Date | string;
|
|
104
|
+
/**
|
|
105
|
+
* Icon to display (can be emoji, React node, or icon class)
|
|
106
|
+
*/
|
|
107
|
+
icon?: default_2.ReactNode;
|
|
108
|
+
/**
|
|
109
|
+
* Optional metadata for the event (e.g., repository name, user, etc.)
|
|
110
|
+
*/
|
|
111
|
+
metadata?: Record<string, unknown>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Provider component for ActivityItem context
|
|
116
|
+
*/
|
|
117
|
+
export declare const ActivityItemProvider: default_2.FC<{
|
|
118
|
+
children: default_2.ReactNode;
|
|
119
|
+
value: ActivityItemContextValue;
|
|
120
|
+
}>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Density options for the activity stream
|
|
124
|
+
*/
|
|
125
|
+
export declare type ActivityStreamDensity = 'comfortable' | 'compact' | 'condensed';
|
|
126
|
+
|
|
65
127
|
/**
|
|
66
128
|
* Pagination configuration for loading more events
|
|
67
129
|
*/
|
|
@@ -109,10 +171,20 @@ export declare const BusinessIcons: {
|
|
|
109
171
|
};
|
|
110
172
|
|
|
111
173
|
/**
|
|
112
|
-
* A customizable button component
|
|
174
|
+
* A customizable button component with accessibility-focused touch targets
|
|
175
|
+
*
|
|
176
|
+
* By default, buttons have a minimum 44×44px touch target for accessibility.
|
|
177
|
+
* Use density='condensed' to allow smaller targets in dense UIs.
|
|
113
178
|
*/
|
|
114
179
|
export declare const Button: default_2.FC<ButtonProps>;
|
|
115
180
|
|
|
181
|
+
/**
|
|
182
|
+
* Density options for button sizing
|
|
183
|
+
* - 'default': Standard 44px minimum touch target for accessibility
|
|
184
|
+
* - 'condensed': Smaller touch target for dense UIs (not recommended for touch devices)
|
|
185
|
+
*/
|
|
186
|
+
export declare type ButtonDensity = 'default' | 'condensed';
|
|
187
|
+
|
|
116
188
|
export declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
117
189
|
/**
|
|
118
190
|
* Variant style of the button
|
|
@@ -122,6 +194,17 @@ export declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTML
|
|
|
122
194
|
* Size of the button
|
|
123
195
|
*/
|
|
124
196
|
size?: 'small' | 'medium' | 'large';
|
|
197
|
+
/**
|
|
198
|
+
* Theme variant ('light' or 'dark')
|
|
199
|
+
*/
|
|
200
|
+
theme?: 'light' | 'dark';
|
|
201
|
+
/**
|
|
202
|
+
* Density of the button - affects minimum touch target size
|
|
203
|
+
* - 'default': Enforces 44px minimum touch target (recommended for accessibility)
|
|
204
|
+
* - 'condensed': Allows smaller touch targets for dense UIs
|
|
205
|
+
* @default 'default'
|
|
206
|
+
*/
|
|
207
|
+
density?: ButtonDensity;
|
|
125
208
|
/**
|
|
126
209
|
* Button contents
|
|
127
210
|
*/
|
|
@@ -364,6 +447,44 @@ export declare interface GridPaginationConfig {
|
|
|
364
447
|
serverSide?: boolean;
|
|
365
448
|
}
|
|
366
449
|
|
|
450
|
+
/**
|
|
451
|
+
* HamburgerButton - An accessible hamburger menu button for drawer/menu controls
|
|
452
|
+
*
|
|
453
|
+
* Features:
|
|
454
|
+
* - Proper ARIA attributes (aria-expanded, aria-controls)
|
|
455
|
+
* - Animated hamburger-to-X transformation
|
|
456
|
+
* - 44x44px minimum touch target by default
|
|
457
|
+
* - Keyboard accessible
|
|
458
|
+
*/
|
|
459
|
+
export declare const HamburgerButton: default_2.FC<HamburgerButtonProps>;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Props for the HamburgerButton component
|
|
463
|
+
*/
|
|
464
|
+
export declare interface HamburgerButtonProps extends Omit<default_2.ButtonHTMLAttributes<HTMLButtonElement>, 'aria-expanded' | 'aria-controls'> {
|
|
465
|
+
/**
|
|
466
|
+
* Whether the controlled menu/drawer is open
|
|
467
|
+
*/
|
|
468
|
+
isOpen: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* ID of the element this button controls (for aria-controls)
|
|
471
|
+
*/
|
|
472
|
+
controlsId: string;
|
|
473
|
+
/**
|
|
474
|
+
* Accessible label for the button
|
|
475
|
+
*/
|
|
476
|
+
ariaLabel?: string;
|
|
477
|
+
/**
|
|
478
|
+
* Additional CSS class names
|
|
479
|
+
*/
|
|
480
|
+
className?: string;
|
|
481
|
+
/**
|
|
482
|
+
* Size variant of the button
|
|
483
|
+
* @default 'medium'
|
|
484
|
+
*/
|
|
485
|
+
size?: 'small' | 'medium' | 'large';
|
|
486
|
+
}
|
|
487
|
+
|
|
367
488
|
export declare const HeartRateIcon: default_2.FC<IconProps>;
|
|
368
489
|
|
|
369
490
|
/**
|
|
@@ -414,6 +535,11 @@ export declare const SatelliteIcon: default_2.FC<IconProps>;
|
|
|
414
535
|
|
|
415
536
|
export declare const ServerIcon: default_2.FC<IconProps>;
|
|
416
537
|
|
|
538
|
+
/**
|
|
539
|
+
* Sidebar variant types
|
|
540
|
+
*/
|
|
541
|
+
export declare type SidebarVariant = 'static' | 'drawer' | 'bottom';
|
|
542
|
+
|
|
417
543
|
export declare const SpaceIcons: {
|
|
418
544
|
rocket: FC<IconProps>;
|
|
419
545
|
satellite: FC<IconProps>;
|
|
@@ -453,6 +579,59 @@ export declare interface TextFormat {
|
|
|
453
579
|
code?: boolean;
|
|
454
580
|
}
|
|
455
581
|
|
|
582
|
+
/**
|
|
583
|
+
* A standalone activity item component that can be used independently or within ActivityStream.
|
|
584
|
+
* Supports compact/mobile layouts through density prop and showMeta flag.
|
|
585
|
+
*/
|
|
586
|
+
export declare const UIForgeActivityItem: default_2.FC<UIForgeActivityItemProps>;
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Props for the UIForgeActivityItem component
|
|
590
|
+
*/
|
|
591
|
+
export declare interface UIForgeActivityItemProps {
|
|
592
|
+
/**
|
|
593
|
+
* The activity event data to display
|
|
594
|
+
*/
|
|
595
|
+
event: ActivityItemEvent;
|
|
596
|
+
/**
|
|
597
|
+
* Whether the item is expanded (shows description)
|
|
598
|
+
*/
|
|
599
|
+
expanded?: boolean;
|
|
600
|
+
/**
|
|
601
|
+
* Callback when the item is toggled
|
|
602
|
+
*/
|
|
603
|
+
onToggle?: (eventId: string | number, expanded: boolean) => void;
|
|
604
|
+
/**
|
|
605
|
+
* Whether the item is expandable (has description or is expandable)
|
|
606
|
+
*/
|
|
607
|
+
expandable?: boolean;
|
|
608
|
+
/**
|
|
609
|
+
* Whether this is a child item (nested styling)
|
|
610
|
+
*/
|
|
611
|
+
isChild?: boolean;
|
|
612
|
+
/**
|
|
613
|
+
* Whether to show the timeline marker
|
|
614
|
+
*/
|
|
615
|
+
showTimeline?: boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Density mode for the item. If not provided, uses context value or 'comfortable'
|
|
618
|
+
*/
|
|
619
|
+
density?: ActivityStreamDensity;
|
|
620
|
+
/**
|
|
621
|
+
* Whether to show metadata (timestamps, descriptions). If not provided, uses context value.
|
|
622
|
+
* When false, hides timestamps and truncates long content.
|
|
623
|
+
*/
|
|
624
|
+
showMeta?: boolean;
|
|
625
|
+
/**
|
|
626
|
+
* Custom icon renderer
|
|
627
|
+
*/
|
|
628
|
+
renderIcon?: (event: ActivityItemEvent) => default_2.ReactNode;
|
|
629
|
+
/**
|
|
630
|
+
* Custom className for styling
|
|
631
|
+
*/
|
|
632
|
+
className?: string;
|
|
633
|
+
}
|
|
634
|
+
|
|
456
635
|
/**
|
|
457
636
|
* A GitHub-inspired activity stream component with smart grouping, timeline, and theming
|
|
458
637
|
*/
|
|
@@ -474,6 +653,10 @@ export declare interface UIForgeActivityStreamProps {
|
|
|
474
653
|
* Custom className for styling
|
|
475
654
|
*/
|
|
476
655
|
className?: string;
|
|
656
|
+
/**
|
|
657
|
+
* Custom inline styles
|
|
658
|
+
*/
|
|
659
|
+
style?: default_2.CSSProperties;
|
|
477
660
|
/**
|
|
478
661
|
* Whether to show the "Show more" bar
|
|
479
662
|
*/
|
|
@@ -529,8 +712,42 @@ export declare interface UIForgeActivityStreamProps {
|
|
|
529
712
|
/**
|
|
530
713
|
* Global scale factor (density) for spacing and icon sizes in the stream.
|
|
531
714
|
* Set to values like 0.8 for compact, 1 for default, 1.2 for spacious.
|
|
715
|
+
* @deprecated Use `density` prop instead for semantic density control.
|
|
532
716
|
*/
|
|
533
717
|
scale?: number;
|
|
718
|
+
/**
|
|
719
|
+
* Density mode for the activity stream.
|
|
720
|
+
* - 'comfortable': Default spacing and sizing (default)
|
|
721
|
+
* - 'compact': Reduced spacing and smaller icons
|
|
722
|
+
* - 'condensed': Minimal spacing for maximum information density
|
|
723
|
+
*/
|
|
724
|
+
density?: ActivityStreamDensity;
|
|
725
|
+
/**
|
|
726
|
+
* Whether to enable responsive density switching based on container width.
|
|
727
|
+
* When true, the component will automatically switch to 'compact' density
|
|
728
|
+
* when the container width is below the breakpoint.
|
|
729
|
+
* @default true
|
|
730
|
+
*/
|
|
731
|
+
responsive?: boolean;
|
|
732
|
+
/**
|
|
733
|
+
* Breakpoint width in pixels below which responsive mode switches to compact.
|
|
734
|
+
* Only applies when `responsive` is true.
|
|
735
|
+
* @default 640
|
|
736
|
+
*/
|
|
737
|
+
compactBreakpointPx?: number;
|
|
738
|
+
/**
|
|
739
|
+
* Optional ref to the container element for responsive measurements.
|
|
740
|
+
* If not provided, an internal ref is used.
|
|
741
|
+
*/
|
|
742
|
+
containerRef?: RefObject<HTMLElement | null>;
|
|
743
|
+
/**
|
|
744
|
+
* Whether to show metadata (timestamps, descriptions, etc.) on activity items.
|
|
745
|
+
* When false, hides timestamps and truncates long content for a denser display.
|
|
746
|
+
* When undefined, metadata is shown by default but may be auto-hidden on narrow containers
|
|
747
|
+
* if responsive is true.
|
|
748
|
+
* @default true
|
|
749
|
+
*/
|
|
750
|
+
showMeta?: boolean;
|
|
534
751
|
/**
|
|
535
752
|
* Custom icon renderer
|
|
536
753
|
*/
|
|
@@ -539,6 +756,19 @@ export declare interface UIForgeActivityStreamProps {
|
|
|
539
756
|
* Custom event renderer
|
|
540
757
|
*/
|
|
541
758
|
renderEvent?: (event: ActivityEvent) => default_2.ReactNode;
|
|
759
|
+
/**
|
|
760
|
+
* Whether to enable virtualization for improved performance with large lists.
|
|
761
|
+
* When enabled, uses react-window to render only visible items.
|
|
762
|
+
* Note: Virtualization may affect animations and dynamic height measurements.
|
|
763
|
+
* @default false
|
|
764
|
+
*/
|
|
765
|
+
virtualization?: boolean;
|
|
766
|
+
/**
|
|
767
|
+
* Height of each item in pixels when virtualization is enabled.
|
|
768
|
+
* Required for react-window's fixed-size list.
|
|
769
|
+
* @default 48
|
|
770
|
+
*/
|
|
771
|
+
virtualItemHeight?: number;
|
|
542
772
|
}
|
|
543
773
|
|
|
544
774
|
/**
|
|
@@ -587,6 +817,10 @@ export declare interface UIForgeBlocksEditorProps {
|
|
|
587
817
|
* Whether the editor is read-only
|
|
588
818
|
*/
|
|
589
819
|
readOnly?: boolean;
|
|
820
|
+
/**
|
|
821
|
+
* Theme variant ('light' or 'dark')
|
|
822
|
+
*/
|
|
823
|
+
theme?: 'light' | 'dark';
|
|
590
824
|
/**
|
|
591
825
|
* Custom CSS class name
|
|
592
826
|
*/
|
|
@@ -631,6 +865,10 @@ export declare interface UIForgeComboBoxProps {
|
|
|
631
865
|
* Async callback for dynamic suggestions (receives search text)
|
|
632
866
|
*/
|
|
633
867
|
onSearch?: (searchText: string, signal?: AbortSignal) => Promise<ComboBoxOption[]>;
|
|
868
|
+
/**
|
|
869
|
+
* Theme variant ('light' or 'dark')
|
|
870
|
+
*/
|
|
871
|
+
theme?: 'light' | 'dark';
|
|
634
872
|
/**
|
|
635
873
|
* Placeholder text
|
|
636
874
|
*/
|
|
@@ -704,7 +942,7 @@ export declare interface UIForgeComboBoxProps {
|
|
|
704
942
|
/**
|
|
705
943
|
* UIForgeGrid - A feature-rich data grid component
|
|
706
944
|
*/
|
|
707
|
-
export declare const UIForgeGrid: <T extends Record<string, unknown>>({ columns, data, selectable, selectedRows: controlledSelectedRows, getRowKey, onSelectionChange, onCellEdit, actionButtons, searchable, searchPlaceholder, onSearch, customFilter, pagination, onPageChange, onPageSizeChange, pageSizeOptions, className, loading, emptyMessage, }: UIForgeGridProps<T>) => JSX.Element;
|
|
945
|
+
export declare const UIForgeGrid: <T extends Record<string, unknown>>({ columns, data, theme, selectable, selectedRows: controlledSelectedRows, getRowKey, onSelectionChange, onCellEdit, actionButtons, searchable, searchPlaceholder, onSearch, customFilter, pagination, onPageChange, onPageSizeChange, pageSizeOptions, className, loading, emptyMessage, }: UIForgeGridProps<T>) => JSX.Element;
|
|
708
946
|
|
|
709
947
|
/**
|
|
710
948
|
* Props for the UIForgeGrid component
|
|
@@ -718,6 +956,10 @@ export declare interface UIForgeGridProps<T = Record<string, unknown>> {
|
|
|
718
956
|
* Data to display in the grid
|
|
719
957
|
*/
|
|
720
958
|
data: T[];
|
|
959
|
+
/**
|
|
960
|
+
* Theme variant ('light' or 'dark')
|
|
961
|
+
*/
|
|
962
|
+
theme?: 'light' | 'dark';
|
|
721
963
|
/**
|
|
722
964
|
* Enable row selection
|
|
723
965
|
*/
|
|
@@ -788,6 +1030,85 @@ export declare interface UIForgeGridProps<T = Record<string, unknown>> {
|
|
|
788
1030
|
emptyMessage?: string;
|
|
789
1031
|
}
|
|
790
1032
|
|
|
1033
|
+
/**
|
|
1034
|
+
* UIForgeSidebar - A reusable sidebar component with multiple variants
|
|
1035
|
+
*
|
|
1036
|
+
* Features:
|
|
1037
|
+
* - Static variant for desktop fixed sidebars
|
|
1038
|
+
* - Drawer variant for slide-in panels with accessibility support
|
|
1039
|
+
* - Bottom variant for mobile bottom navigation
|
|
1040
|
+
* - Focus trapping for drawer/bottom variants
|
|
1041
|
+
* - ESC and backdrop click to close
|
|
1042
|
+
* - CSS safe-area insets support
|
|
1043
|
+
*/
|
|
1044
|
+
export declare const UIForgeSidebar: default_2.FC<UIForgeSidebarProps>;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Props for the UIForgeSidebar component
|
|
1048
|
+
*/
|
|
1049
|
+
export declare interface UIForgeSidebarProps {
|
|
1050
|
+
/**
|
|
1051
|
+
* Unique identifier for the sidebar element
|
|
1052
|
+
* Useful for linking with aria-controls on trigger buttons
|
|
1053
|
+
*/
|
|
1054
|
+
id?: string;
|
|
1055
|
+
/**
|
|
1056
|
+
* Variant style of the sidebar
|
|
1057
|
+
* - 'static': Desktop fixed sidebar (default)
|
|
1058
|
+
* - 'drawer': Slide-in panel for mobile & small containers
|
|
1059
|
+
* - 'bottom': Bottom navigation variant for mobile
|
|
1060
|
+
*/
|
|
1061
|
+
variant?: SidebarVariant;
|
|
1062
|
+
/**
|
|
1063
|
+
* Whether the sidebar is open (only applies to 'drawer' and 'bottom' variants)
|
|
1064
|
+
*/
|
|
1065
|
+
open?: boolean;
|
|
1066
|
+
/**
|
|
1067
|
+
* Callback when open state changes (only applies to 'drawer' and 'bottom' variants)
|
|
1068
|
+
*/
|
|
1069
|
+
onOpenChange?: (open: boolean) => void;
|
|
1070
|
+
/**
|
|
1071
|
+
* Content to display inside the sidebar
|
|
1072
|
+
*/
|
|
1073
|
+
children: default_2.ReactNode;
|
|
1074
|
+
/**
|
|
1075
|
+
* Additional CSS class names
|
|
1076
|
+
*/
|
|
1077
|
+
className?: string;
|
|
1078
|
+
/**
|
|
1079
|
+
* ARIA label for the sidebar
|
|
1080
|
+
*/
|
|
1081
|
+
ariaLabel?: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Width of the sidebar (CSS value, applies to 'static' and 'drawer' variants)
|
|
1084
|
+
*/
|
|
1085
|
+
width?: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Height of the sidebar (CSS value, applies to 'bottom' variant only)
|
|
1088
|
+
*/
|
|
1089
|
+
height?: string;
|
|
1090
|
+
/**
|
|
1091
|
+
* Position of the sidebar for 'static' and 'drawer' variants
|
|
1092
|
+
*/
|
|
1093
|
+
position?: 'left' | 'right';
|
|
1094
|
+
/**
|
|
1095
|
+
* Whether to show the backdrop overlay (only applies to 'drawer' and 'bottom' variants)
|
|
1096
|
+
*/
|
|
1097
|
+
showBackdrop?: boolean;
|
|
1098
|
+
/**
|
|
1099
|
+
* Whether to close on backdrop click (only applies when showBackdrop is true)
|
|
1100
|
+
*/
|
|
1101
|
+
closeOnBackdropClick?: boolean;
|
|
1102
|
+
/**
|
|
1103
|
+
* Whether to close on ESC key press (only applies to 'drawer' and 'bottom' variants)
|
|
1104
|
+
*/
|
|
1105
|
+
closeOnEscape?: boolean;
|
|
1106
|
+
/**
|
|
1107
|
+
* Whether to trap focus within the sidebar (only applies to 'drawer' and 'bottom' variants)
|
|
1108
|
+
*/
|
|
1109
|
+
trapFocus?: boolean;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
791
1112
|
/**
|
|
792
1113
|
* UIForgeVideo - A universal video component that supports 30+ video platforms
|
|
793
1114
|
*
|
|
@@ -952,6 +1273,21 @@ export declare interface UIForgeVideoProps {
|
|
|
952
1273
|
* Height of the video player
|
|
953
1274
|
*/
|
|
954
1275
|
height?: string | number;
|
|
1276
|
+
/**
|
|
1277
|
+
* Maximum height of the video player
|
|
1278
|
+
*/
|
|
1279
|
+
maxHeight?: string | number;
|
|
1280
|
+
/**
|
|
1281
|
+
* Enable responsive behavior (aspect-video, full width, no min-height constraints)
|
|
1282
|
+
* When true, uses aspect-ratio layout that scales correctly on small screens
|
|
1283
|
+
* @default false
|
|
1284
|
+
*/
|
|
1285
|
+
responsive?: boolean;
|
|
1286
|
+
/**
|
|
1287
|
+
* Hide the header (title and description) for tight mobile UIs
|
|
1288
|
+
* @default false
|
|
1289
|
+
*/
|
|
1290
|
+
hideHeader?: boolean;
|
|
955
1291
|
/**
|
|
956
1292
|
* Custom overlay icon (defaults to play icon)
|
|
957
1293
|
*/
|
|
@@ -976,6 +1312,94 @@ export declare const UIIcons: {
|
|
|
976
1312
|
|
|
977
1313
|
export declare const UnfoldIcon: default_2.FC<IconProps>;
|
|
978
1314
|
|
|
1315
|
+
/**
|
|
1316
|
+
* Hook to access the ActivityItem context
|
|
1317
|
+
*/
|
|
1318
|
+
export declare function useActivityItemContext(): ActivityItemContextValue;
|
|
1319
|
+
|
|
1320
|
+
/**
|
|
1321
|
+
* A hook that dynamically calculates the optimal page size for paginated lists
|
|
1322
|
+
* based on the container's available height and item measurements.
|
|
1323
|
+
*
|
|
1324
|
+
* Uses ResizeObserver to respond to container size changes and MutationObserver
|
|
1325
|
+
* to detect when new items are added to the container.
|
|
1326
|
+
*
|
|
1327
|
+
* @param containerRef - A ref to the scrollable container element
|
|
1328
|
+
* @param options - Configuration options for the hook
|
|
1329
|
+
* @returns The calculated page size, clamped to [min, max]
|
|
1330
|
+
*
|
|
1331
|
+
* @example
|
|
1332
|
+
* ```tsx
|
|
1333
|
+
* function PaginatedList() {
|
|
1334
|
+
* const containerRef = useRef<HTMLDivElement>(null)
|
|
1335
|
+
* const pageSize = useDynamicPageCount(containerRef, {
|
|
1336
|
+
* sampleCount: 3,
|
|
1337
|
+
* min: 5,
|
|
1338
|
+
* max: 20,
|
|
1339
|
+
* approxItemHeight: 100,
|
|
1340
|
+
* })
|
|
1341
|
+
*
|
|
1342
|
+
* return (
|
|
1343
|
+
* <div ref={containerRef} style={{ height: '600px', overflow: 'auto' }}>
|
|
1344
|
+
* {items.slice(0, pageSize).map(item => <ListItem key={item.id} {...item} />)}
|
|
1345
|
+
* </div>
|
|
1346
|
+
* )
|
|
1347
|
+
* }
|
|
1348
|
+
* ```
|
|
1349
|
+
*/
|
|
1350
|
+
export declare function useDynamicPageCount(containerRef: RefObject<HTMLElement | null> | null, options?: UseDynamicPageCountOptions): number;
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* Options for the useDynamicPageCount hook
|
|
1354
|
+
*/
|
|
1355
|
+
export declare interface UseDynamicPageCountOptions {
|
|
1356
|
+
/**
|
|
1357
|
+
* Number of sample items to measure for calculating average item height.
|
|
1358
|
+
* @default 3
|
|
1359
|
+
*/
|
|
1360
|
+
sampleCount?: number;
|
|
1361
|
+
/**
|
|
1362
|
+
* Minimum page size to return.
|
|
1363
|
+
* @default 3
|
|
1364
|
+
*/
|
|
1365
|
+
min?: number;
|
|
1366
|
+
/**
|
|
1367
|
+
* Maximum page size to return.
|
|
1368
|
+
* @default 15
|
|
1369
|
+
*/
|
|
1370
|
+
max?: number;
|
|
1371
|
+
/**
|
|
1372
|
+
* Approximate item height in pixels used as fallback when items cannot be measured.
|
|
1373
|
+
* @default 120
|
|
1374
|
+
*/
|
|
1375
|
+
approxItemHeight?: number;
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/**
|
|
1379
|
+
* A hook that determines whether a container element is "compact" by measuring its width.
|
|
1380
|
+
* Uses ResizeObserver to respond to container size changes.
|
|
1381
|
+
*
|
|
1382
|
+
* @param containerRef - A ref to the HTML element to observe, or null
|
|
1383
|
+
* @param breakpointPx - The width threshold in pixels (default: 640). Returns true when width < breakpointPx
|
|
1384
|
+
* @returns true when the container width is less than breakpointPx, false otherwise.
|
|
1385
|
+
* Returns false when the container width is 0 (not rendered/measured yet).
|
|
1386
|
+
*
|
|
1387
|
+
* @example
|
|
1388
|
+
* ```tsx
|
|
1389
|
+
* function ResponsiveComponent() {
|
|
1390
|
+
* const containerRef = useRef<HTMLDivElement>(null)
|
|
1391
|
+
* const isCompact = useResponsive(containerRef, 640)
|
|
1392
|
+
*
|
|
1393
|
+
* return (
|
|
1394
|
+
* <div ref={containerRef}>
|
|
1395
|
+
* {isCompact ? <MobileLayout /> : <DesktopLayout />}
|
|
1396
|
+
* </div>
|
|
1397
|
+
* )
|
|
1398
|
+
* }
|
|
1399
|
+
* ```
|
|
1400
|
+
*/
|
|
1401
|
+
export declare function useResponsive(containerRef: RefObject<HTMLElement | null> | null, breakpointPx?: number): boolean;
|
|
1402
|
+
|
|
979
1403
|
/**
|
|
980
1404
|
* Result of video ID extraction from a URL
|
|
981
1405
|
*/
|