@neynar/ui 0.1.1 → 0.1.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/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- package/src/components/ui/typography.tsx +1115 -165
|
@@ -5,68 +5,209 @@ import * as ResizablePrimitive from "react-resizable-panels";
|
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Props for ResizablePanelGroup component (Documentation only - NOT used in component implementation)
|
|
9
|
+
* These types are for documentation generation and should not replace react-resizable-panels inferred types
|
|
10
|
+
*/
|
|
11
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
12
|
+
type ResizablePanelGroupDocsProps = {
|
|
13
|
+
/** Layout direction for panels within the group */
|
|
14
|
+
direction: "horizontal" | "vertical";
|
|
15
|
+
/** Optional identifier for automatic save/restore of panel layouts @default undefined */
|
|
16
|
+
autoSaveId?: string | null;
|
|
17
|
+
/** Unique identifier for the panel group @default undefined */
|
|
18
|
+
id?: string | null;
|
|
19
|
+
/** Keyboard resize increment in percentage points @default undefined */
|
|
20
|
+
keyboardResizeBy?: number | null;
|
|
21
|
+
/** Callback fired when panel layout changes with array of panel sizes */
|
|
22
|
+
onLayout?: (layout: number[]) => void;
|
|
23
|
+
/** Custom storage implementation for persisting panel layouts @default localStorage */
|
|
24
|
+
storage?: {
|
|
25
|
+
getItem(name: string): string | null;
|
|
26
|
+
setItem(name: string, value: string): void;
|
|
27
|
+
};
|
|
28
|
+
/** Text direction for RTL/LTR layout support @default "ltr" */
|
|
29
|
+
dir?: "auto" | "ltr" | "rtl";
|
|
30
|
+
/** HTML element tag name to render @default "div" */
|
|
31
|
+
tagName?: keyof React.JSX.IntrinsicElements;
|
|
32
|
+
/** Additional CSS classes */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** Inline styles for the panel group */
|
|
35
|
+
style?: React.CSSProperties;
|
|
36
|
+
/** Child components - should contain ResizablePanel and ResizableHandle components */
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Props for ResizablePanel component (Documentation only - NOT used in component implementation)
|
|
42
|
+
* These types are for documentation generation and should not replace react-resizable-panels inferred types
|
|
43
|
+
*/
|
|
44
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
45
|
+
type ResizablePanelDocsProps = {
|
|
46
|
+
/** Unique identifier for the panel - required for conditional rendering @default undefined */
|
|
47
|
+
id?: string;
|
|
48
|
+
/** Display order within the panel group - important for conditional rendering @default undefined */
|
|
49
|
+
order?: number;
|
|
50
|
+
/** Initial size as percentage (0-100) when panel is first rendered @default undefined */
|
|
51
|
+
defaultSize?: number;
|
|
52
|
+
/** Minimum size constraint as percentage (0-100) @default undefined */
|
|
53
|
+
minSize?: number;
|
|
54
|
+
/** Maximum size constraint as percentage (0-100) @default undefined */
|
|
55
|
+
maxSize?: number;
|
|
56
|
+
/** Whether panel can be collapsed to zero or collapsedSize @default false */
|
|
57
|
+
collapsible?: boolean;
|
|
58
|
+
/** Size when collapsed - must be between 0 and minSize @default 0 */
|
|
59
|
+
collapsedSize?: number;
|
|
60
|
+
/** Callback fired when panel is collapsed to its minimum size */
|
|
61
|
+
onCollapse?: () => void;
|
|
62
|
+
/** Callback fired when panel is expanded from collapsed state */
|
|
63
|
+
onExpand?: () => void;
|
|
64
|
+
/** Callback fired when panel is resized with current and previous sizes */
|
|
65
|
+
onResize?: (size: number, prevSize: number | undefined) => void;
|
|
66
|
+
/** HTML element tag name to render @default "div" */
|
|
67
|
+
tagName?: keyof React.JSX.IntrinsicElements;
|
|
68
|
+
/** Additional CSS classes */
|
|
69
|
+
className?: string;
|
|
70
|
+
/** Inline styles for the panel */
|
|
71
|
+
style?: React.CSSProperties;
|
|
72
|
+
/** Panel content */
|
|
73
|
+
children?: React.ReactNode;
|
|
74
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Props for ResizableHandle component (Documentation only - NOT used in component implementation)
|
|
78
|
+
* These types are for documentation generation and should not replace react-resizable-panels inferred types
|
|
79
|
+
*/
|
|
80
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
81
|
+
type ResizableHandleDocsProps = {
|
|
82
|
+
/** Whether to show a visual grip handle @default false */
|
|
83
|
+
withHandle?: boolean;
|
|
84
|
+
/** Unique identifier for the resize handle @default undefined */
|
|
85
|
+
id?: string | null;
|
|
86
|
+
/** Whether the handle is disabled and non-interactive @default false */
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
/** Custom hit area margins for easier interaction @default { coarse: 15, fine: 5 } */
|
|
89
|
+
hitAreaMargins?: {
|
|
90
|
+
coarse: number;
|
|
91
|
+
fine: number;
|
|
92
|
+
};
|
|
93
|
+
/** Callback fired when dragging state changes */
|
|
94
|
+
onDragging?: (isDragging: boolean) => void;
|
|
95
|
+
/** Callback fired when handle loses focus */
|
|
96
|
+
onBlur?: () => void;
|
|
97
|
+
/** Callback fired when handle is clicked */
|
|
98
|
+
onClick?: () => void;
|
|
99
|
+
/** Callback fired when handle gains focus */
|
|
100
|
+
onFocus?: () => void;
|
|
101
|
+
/** Callback fired when pointer is pressed down on handle */
|
|
102
|
+
onPointerDown?: () => void;
|
|
103
|
+
/** Callback fired when pointer is released from handle */
|
|
104
|
+
onPointerUp?: () => void;
|
|
105
|
+
/** Tab index for keyboard navigation @default 0 */
|
|
106
|
+
tabIndex?: number;
|
|
107
|
+
/** HTML element tag name to render @default "div" */
|
|
108
|
+
tagName?: keyof React.JSX.IntrinsicElements;
|
|
109
|
+
/** Additional CSS classes */
|
|
110
|
+
className?: string;
|
|
111
|
+
/** Inline styles for the handle */
|
|
112
|
+
style?: React.CSSProperties;
|
|
113
|
+
/** Custom handle content - overrides withHandle prop */
|
|
114
|
+
children?: React.ReactNode;
|
|
115
|
+
} & React.HTMLAttributes<HTMLDivElement>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Container for creating resizable panel groups with full keyboard accessibility
|
|
9
119
|
*
|
|
10
|
-
* ResizablePanelGroup provides a flexible container for organizing multiple resizable panels
|
|
11
|
-
*
|
|
12
|
-
* Built on
|
|
120
|
+
* ResizablePanelGroup provides a flexible container for organizing multiple resizable panels
|
|
121
|
+
* that can be resized by dragging handles between them or using keyboard navigation.
|
|
122
|
+
* Built on react-resizable-panels with enhanced styling, accessibility, and persistence features.
|
|
123
|
+
* Supports both horizontal and vertical layouts with automatic layout saving and restoration.
|
|
13
124
|
*
|
|
14
125
|
* @example
|
|
15
126
|
* ```tsx
|
|
16
127
|
* // Basic horizontal layout
|
|
17
128
|
* <ResizablePanelGroup direction="horizontal" className="h-full">
|
|
18
129
|
* <ResizablePanel defaultSize={50}>
|
|
19
|
-
* <div className="p-4">Left panel</div>
|
|
130
|
+
* <div className="p-4">Left panel content</div>
|
|
20
131
|
* </ResizablePanel>
|
|
21
132
|
* <ResizableHandle />
|
|
22
133
|
* <ResizablePanel defaultSize={50}>
|
|
23
|
-
* <div className="p-4">Right panel</div>
|
|
134
|
+
* <div className="p-4">Right panel content</div>
|
|
24
135
|
* </ResizablePanel>
|
|
25
136
|
* </ResizablePanelGroup>
|
|
26
137
|
* ```
|
|
27
138
|
*
|
|
28
139
|
* @example
|
|
29
140
|
* ```tsx
|
|
30
|
-
* // Vertical layout with
|
|
141
|
+
* // Vertical layout with visual handles
|
|
31
142
|
* <ResizablePanelGroup direction="vertical" className="min-h-[400px]">
|
|
32
143
|
* <ResizablePanel defaultSize={30}>
|
|
33
|
-
* <header>Header content</header>
|
|
144
|
+
* <header className="p-4">Header content</header>
|
|
34
145
|
* </ResizablePanel>
|
|
35
146
|
* <ResizableHandle withHandle />
|
|
36
147
|
* <ResizablePanel defaultSize={70}>
|
|
37
|
-
* <main>Main content</main>
|
|
148
|
+
* <main className="p-4">Main content area</main>
|
|
38
149
|
* </ResizablePanel>
|
|
39
150
|
* </ResizablePanelGroup>
|
|
40
151
|
* ```
|
|
41
152
|
*
|
|
42
153
|
* @example
|
|
43
154
|
* ```tsx
|
|
44
|
-
* //
|
|
45
|
-
* <ResizablePanelGroup
|
|
155
|
+
* // Persistent layout with auto-save
|
|
156
|
+
* <ResizablePanelGroup
|
|
157
|
+
* direction="horizontal"
|
|
158
|
+
* autoSaveId="main-layout"
|
|
159
|
+
* onLayout={(sizes) => console.log('Layout changed:', sizes)}
|
|
160
|
+
* >
|
|
46
161
|
* <ResizablePanel defaultSize={25} minSize={20} maxSize={40}>
|
|
47
162
|
* <nav>Sidebar (20-40%)</nav>
|
|
48
163
|
* </ResizablePanel>
|
|
49
164
|
* <ResizableHandle withHandle />
|
|
50
165
|
* <ResizablePanel defaultSize={75} minSize={60}>
|
|
51
|
-
* <main>Content (min 60%)</main>
|
|
166
|
+
* <main>Content area (min 60%)</main>
|
|
167
|
+
* </ResizablePanel>
|
|
168
|
+
* </ResizablePanelGroup>
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```tsx
|
|
173
|
+
* // Custom keyboard resize increment
|
|
174
|
+
* <ResizablePanelGroup
|
|
175
|
+
* direction="horizontal"
|
|
176
|
+
* keyboardResizeBy={5}
|
|
177
|
+
* dir="ltr"
|
|
178
|
+
* >
|
|
179
|
+
* <ResizablePanel defaultSize={50} id="left-panel">
|
|
180
|
+
* <div>Panel content</div>
|
|
181
|
+
* </ResizablePanel>
|
|
182
|
+
* <ResizableHandle />
|
|
183
|
+
* <ResizablePanel defaultSize={50} id="right-panel">
|
|
184
|
+
* <div>Panel content</div>
|
|
52
185
|
* </ResizablePanel>
|
|
53
186
|
* </ResizablePanelGroup>
|
|
54
187
|
* ```
|
|
55
188
|
*
|
|
56
|
-
* @param direction - Layout direction: "horizontal"
|
|
57
|
-
* @param
|
|
189
|
+
* @param direction - Layout direction: "horizontal" for side-by-side, "vertical" for top-to-bottom
|
|
190
|
+
* @param autoSaveId - Unique identifier for automatically saving/restoring panel layouts
|
|
191
|
+
* @param onLayout - Callback fired when panel sizes change, receives array of percentages
|
|
192
|
+
* @param keyboardResizeBy - Increment in percentage points for keyboard-based resizing
|
|
193
|
+
* @param storage - Custom storage implementation for layout persistence (defaults to localStorage)
|
|
194
|
+
* @param dir - Text direction for RTL/LTR layout support
|
|
195
|
+
* @param className - Additional CSS classes for custom styling
|
|
58
196
|
* @param children - ResizablePanel and ResizableHandle components
|
|
59
197
|
*
|
|
60
198
|
* @accessibility
|
|
61
|
-
* - Full keyboard navigation
|
|
62
|
-
* - Screen reader
|
|
63
|
-
* - Respects prefers-reduced-motion
|
|
64
|
-
* - Maintains focus
|
|
199
|
+
* - Full keyboard navigation: Arrow keys resize panels when handles are focused
|
|
200
|
+
* - Screen reader announcements for panel size changes and resize operations
|
|
201
|
+
* - Respects prefers-reduced-motion to disable animations for motion-sensitive users
|
|
202
|
+
* - Maintains logical focus order and proper tab navigation
|
|
203
|
+
* - Provides ARIA labels and roles for assistive technology
|
|
204
|
+
* - Keyboard shortcuts: Home/End keys jump to min/max sizes
|
|
65
205
|
*
|
|
66
|
-
* @see {@link https://
|
|
206
|
+
* @see {@link https://react-resizable-panels.vercel.app/} Official react-resizable-panels documentation
|
|
207
|
+
* @see {@link https://ui.shadcn.com/docs/components/resizable} Design patterns and examples
|
|
208
|
+
* @see {@link ResizablePanel} Individual panel configuration options
|
|
209
|
+
* @see {@link ResizableHandle} Handle customization and interaction options
|
|
67
210
|
* @since 1.0.0
|
|
68
|
-
* @see {@link ResizablePanel} for individual panel configuration
|
|
69
|
-
* @see {@link ResizableHandle} for handle customization options
|
|
70
211
|
*/
|
|
71
212
|
function ResizablePanelGroup({
|
|
72
213
|
className,
|
|
@@ -85,11 +226,12 @@ function ResizablePanelGroup({
|
|
|
85
226
|
}
|
|
86
227
|
|
|
87
228
|
/**
|
|
88
|
-
* Individual resizable panel within a panel group
|
|
229
|
+
* Individual resizable panel within a panel group with size constraints and callbacks
|
|
89
230
|
*
|
|
90
|
-
* ResizablePanel represents a single section
|
|
91
|
-
* Supports
|
|
92
|
-
*
|
|
231
|
+
* ResizablePanel represents a single resizable section within a ResizablePanelGroup.
|
|
232
|
+
* Supports flexible sizing constraints, collapse/expand behavior, and programmatic control
|
|
233
|
+
* through imperative API. Each panel automatically handles content overflow and maintains
|
|
234
|
+
* accessibility during resize operations with proper focus and scroll management.
|
|
93
235
|
*
|
|
94
236
|
* @example
|
|
95
237
|
* ```tsx
|
|
@@ -101,31 +243,78 @@ function ResizablePanelGroup({
|
|
|
101
243
|
*
|
|
102
244
|
* @example
|
|
103
245
|
* ```tsx
|
|
104
|
-
* // Panel with size constraints
|
|
246
|
+
* // Panel with size constraints and callbacks
|
|
105
247
|
* <ResizablePanel
|
|
248
|
+
* id="sidebar"
|
|
106
249
|
* defaultSize={30}
|
|
107
250
|
* minSize={20}
|
|
108
251
|
* maxSize={60}
|
|
109
252
|
* collapsible
|
|
253
|
+
* onCollapse={() => console.log('Sidebar collapsed')}
|
|
254
|
+
* onExpand={() => console.log('Sidebar expanded')}
|
|
255
|
+
* onResize={(size, prevSize) => console.log(`Resized from ${prevSize}% to ${size}%`)}
|
|
256
|
+
* >
|
|
257
|
+
* <aside className="p-4">Collapsible sidebar content</aside>
|
|
258
|
+
* </ResizablePanel>
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```tsx
|
|
263
|
+
* // Panel with conditional rendering support
|
|
264
|
+
* <ResizablePanel
|
|
265
|
+
* id="dynamic-panel"
|
|
266
|
+
* order={1}
|
|
267
|
+
* defaultSize={40}
|
|
268
|
+
* collapsible
|
|
269
|
+
* collapsedSize={5}
|
|
110
270
|
* >
|
|
111
|
-
* <
|
|
271
|
+
* {isExpanded ? <FullContent /> : <CollapsedView />}
|
|
112
272
|
* </ResizablePanel>
|
|
113
273
|
* ```
|
|
114
274
|
*
|
|
115
|
-
* @
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```tsx
|
|
277
|
+
* // Panel with imperative control via ref
|
|
278
|
+
* function PanelWithControl() {
|
|
279
|
+
* const panelRef = useRef<ImperativePanelHandle>(null);
|
|
280
|
+
*
|
|
281
|
+
* return (
|
|
282
|
+
* <>
|
|
283
|
+
* <button onClick={() => panelRef.current?.collapse()}>
|
|
284
|
+
* Collapse Panel
|
|
285
|
+
* </button>
|
|
286
|
+
* <ResizablePanel ref={panelRef} defaultSize={50} collapsible>
|
|
287
|
+
* <div>Controlled panel content</div>
|
|
288
|
+
* </ResizablePanel>
|
|
289
|
+
* </>
|
|
290
|
+
* );
|
|
291
|
+
* }
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @param id - Unique identifier for programmatic control and conditional rendering
|
|
295
|
+
* @param order - Display order within group, important when panels are conditionally rendered
|
|
296
|
+
* @param defaultSize - Initial size as percentage (0-100) when panel first mounts
|
|
297
|
+
* @param minSize - Minimum size constraint as percentage (0-100)
|
|
298
|
+
* @param maxSize - Maximum size constraint as percentage (0-100)
|
|
299
|
+
* @param collapsible - Whether panel can collapse beyond minSize to collapsedSize
|
|
300
|
+
* @param collapsedSize - Size when fully collapsed, must be between 0 and minSize
|
|
301
|
+
* @param onCollapse - Callback fired when panel collapses to minimum size
|
|
302
|
+
* @param onExpand - Callback fired when panel expands from collapsed state
|
|
303
|
+
* @param onResize - Callback fired during resize with current and previous sizes
|
|
304
|
+
* @param className - Additional CSS classes for custom styling
|
|
305
|
+
* @param children - Panel content elements
|
|
124
306
|
*
|
|
125
307
|
* @accessibility
|
|
126
|
-
* -
|
|
127
|
-
* -
|
|
128
|
-
* - Announces size changes to screen readers
|
|
308
|
+
* - Preserves focus within panel content during resize operations
|
|
309
|
+
* - Maintains scroll position when panel dimensions change
|
|
310
|
+
* - Announces significant size changes to screen readers
|
|
311
|
+
* - Supports keyboard navigation when combined with ResizableHandle
|
|
312
|
+
* - Respects reduced motion preferences for smooth resize animations
|
|
313
|
+
*
|
|
314
|
+
* @see {@link https://react-resizable-panels.vercel.app/} API documentation and examples
|
|
315
|
+
* @see {@link ResizablePanelGroup} Container component for panel organization
|
|
316
|
+
* @see {@link ResizableHandle} Interactive handles for resizing panels
|
|
317
|
+
* @since 1.0.0
|
|
129
318
|
*/
|
|
130
319
|
function ResizablePanel({
|
|
131
320
|
...props
|
|
@@ -134,15 +323,16 @@ function ResizablePanel({
|
|
|
134
323
|
}
|
|
135
324
|
|
|
136
325
|
/**
|
|
137
|
-
*
|
|
326
|
+
* Interactive handle for resizing panels with full keyboard and pointer support
|
|
138
327
|
*
|
|
139
|
-
* ResizableHandle provides the
|
|
140
|
-
* resize them via mouse, touch, or keyboard.
|
|
141
|
-
*
|
|
328
|
+
* ResizableHandle provides the draggable area between panels that allows users to
|
|
329
|
+
* resize them via mouse, touch, or keyboard interaction. Supports optional visual
|
|
330
|
+
* grip indicators, custom hit areas, and comprehensive event callbacks for advanced
|
|
331
|
+
* interaction patterns. Automatically adapts styling based on panel group direction.
|
|
142
332
|
*
|
|
143
333
|
* @example
|
|
144
334
|
* ```tsx
|
|
145
|
-
* // Basic invisible handle
|
|
335
|
+
* // Basic invisible handle (common for clean designs)
|
|
146
336
|
* <ResizableHandle />
|
|
147
337
|
* ```
|
|
148
338
|
*
|
|
@@ -154,40 +344,76 @@ function ResizablePanel({
|
|
|
154
344
|
*
|
|
155
345
|
* @example
|
|
156
346
|
* ```tsx
|
|
157
|
-
* // Custom styled handle
|
|
347
|
+
* // Custom styled handle with interaction callbacks
|
|
158
348
|
* <ResizableHandle
|
|
159
349
|
* withHandle
|
|
160
|
-
* className="bg-blue-200 hover:bg-blue-300"
|
|
350
|
+
* className="bg-blue-200 hover:bg-blue-300 transition-colors"
|
|
351
|
+
* onDragging={(isDragging) => {
|
|
352
|
+
* console.log(isDragging ? 'Started dragging' : 'Stopped dragging');
|
|
353
|
+
* }}
|
|
354
|
+
* hitAreaMargins={{ coarse: 20, fine: 10 }}
|
|
355
|
+
* />
|
|
356
|
+
* ```
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```tsx
|
|
360
|
+
* // Disabled handle for non-interactive layouts
|
|
361
|
+
* <ResizableHandle
|
|
362
|
+
* disabled
|
|
363
|
+
* className="opacity-50 cursor-not-allowed"
|
|
161
364
|
* />
|
|
162
365
|
* ```
|
|
163
366
|
*
|
|
164
|
-
* @
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```tsx
|
|
369
|
+
* // Custom handle with event handling
|
|
370
|
+
* <ResizableHandle
|
|
371
|
+
* id="main-handle"
|
|
372
|
+
* onFocus={() => console.log('Handle focused')}
|
|
373
|
+
* onBlur={() => console.log('Handle blurred')}
|
|
374
|
+
* onClick={() => console.log('Handle clicked')}
|
|
375
|
+
* tabIndex={0}
|
|
376
|
+
* >
|
|
377
|
+
* <CustomGripIcon />
|
|
378
|
+
* </ResizableHandle>
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @param withHandle - Whether to display built-in visual grip indicator
|
|
382
|
+
* @param id - Unique identifier for the resize handle
|
|
383
|
+
* @param disabled - Whether handle is disabled and non-interactive
|
|
384
|
+
* @param hitAreaMargins - Custom hit area margins for easier grabbing (coarse: touch devices, fine: mouse)
|
|
385
|
+
* @param onDragging - Callback fired when drag state changes with boolean indicating if currently dragging
|
|
386
|
+
* @param onFocus - Callback fired when handle receives keyboard focus
|
|
387
|
+
* @param onBlur - Callback fired when handle loses keyboard focus
|
|
388
|
+
* @param onClick - Callback fired when handle is clicked
|
|
389
|
+
* @param onPointerDown - Callback fired when pointer/touch starts on handle
|
|
390
|
+
* @param onPointerUp - Callback fired when pointer/touch ends on handle
|
|
391
|
+
* @param tabIndex - Tab order for keyboard navigation (0 makes it focusable)
|
|
392
|
+
* @param className - Additional CSS classes for custom styling
|
|
393
|
+
* @param children - Custom handle content (overrides withHandle prop)
|
|
169
394
|
*
|
|
170
395
|
* @accessibility
|
|
171
|
-
* -
|
|
396
|
+
* - Full keyboard support: Arrow keys resize panels when handle is focused
|
|
172
397
|
* - Proper ARIA roles and labels for screen readers
|
|
173
|
-
* -
|
|
174
|
-
* - Touch-friendly hit area
|
|
175
|
-
* - Announces resize actions and
|
|
398
|
+
* - High contrast focus indicators that meet WCAG AAA requirements
|
|
399
|
+
* - Touch-friendly hit area with minimum 44x44px interactive zone
|
|
400
|
+
* - Announces resize actions and panel sizes to assistive technology
|
|
401
|
+
* - Supports reduced motion preferences for drag animations
|
|
402
|
+
* - Maintains logical tab order within panel layouts
|
|
176
403
|
*
|
|
177
|
-
* @see {@link https://
|
|
404
|
+
* @see {@link https://react-resizable-panels.vercel.app/} Interactive demos and API reference
|
|
405
|
+
* @see {@link https://ui.shadcn.com/docs/components/resizable} Design patterns and styling examples
|
|
406
|
+
* @see {@link ResizablePanelGroup} Container component for handle placement
|
|
407
|
+
* @see {@link ResizablePanel} Panels that handles resize between
|
|
178
408
|
* @since 1.0.0
|
|
179
409
|
*/
|
|
180
410
|
function ResizableHandle({
|
|
181
411
|
withHandle,
|
|
182
412
|
className,
|
|
183
413
|
...props
|
|
184
|
-
}: React.ComponentProps<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
* @default false
|
|
188
|
-
*/
|
|
189
|
-
withHandle?: boolean;
|
|
190
|
-
}) {
|
|
414
|
+
}: { withHandle?: boolean } & React.ComponentProps<
|
|
415
|
+
typeof ResizablePrimitive.PanelResizeHandle
|
|
416
|
+
>) {
|
|
191
417
|
return (
|
|
192
418
|
<ResizablePrimitive.PanelResizeHandle
|
|
193
419
|
data-slot="resizable-handle"
|