@principal-ade/panels 1.0.39

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.
Files changed (39) hide show
  1. package/README.md +360 -0
  2. package/dist/components/AnimatedResizableLayout.d.ts +42 -0
  3. package/dist/components/AnimatedResizableLayout.d.ts.map +1 -0
  4. package/dist/components/AnimatedVerticalLayout.d.ts +59 -0
  5. package/dist/components/AnimatedVerticalLayout.d.ts.map +1 -0
  6. package/dist/components/ConfigurablePanelLayout.d.ts +87 -0
  7. package/dist/components/ConfigurablePanelLayout.d.ts.map +1 -0
  8. package/dist/components/EditableConfigurablePanelLayout.d.ts +17 -0
  9. package/dist/components/EditableConfigurablePanelLayout.d.ts.map +1 -0
  10. package/dist/components/PanelConfigurator.d.ts +55 -0
  11. package/dist/components/PanelConfigurator.d.ts.map +1 -0
  12. package/dist/components/ResponsiveConfigurablePanelLayout.d.ts +21 -0
  13. package/dist/components/ResponsiveConfigurablePanelLayout.d.ts.map +1 -0
  14. package/dist/components/SnapCarousel.d.ts +38 -0
  15. package/dist/components/SnapCarousel.d.ts.map +1 -0
  16. package/dist/components/TabGroup.d.ts +21 -0
  17. package/dist/components/TabGroup.d.ts.map +1 -0
  18. package/dist/components/ThreePanelLayout.d.ts +63 -0
  19. package/dist/components/ThreePanelLayout.d.ts.map +1 -0
  20. package/dist/hooks/useLocalStorage.d.ts +2 -0
  21. package/dist/hooks/useLocalStorage.d.ts.map +1 -0
  22. package/dist/hooks/useMediaQuery.d.ts +2 -0
  23. package/dist/hooks/useMediaQuery.d.ts.map +1 -0
  24. package/dist/index.d.ts +15 -0
  25. package/dist/index.d.ts.map +1 -0
  26. package/dist/index.esm.js +58 -0
  27. package/dist/index.esm.js.map +1 -0
  28. package/dist/index.umd.js +2 -0
  29. package/dist/index.umd.js.map +1 -0
  30. package/dist/panels.css +1 -0
  31. package/dist/test/setup.d.ts +1 -0
  32. package/dist/test/setup.d.ts.map +1 -0
  33. package/dist/types/index.d.ts +24 -0
  34. package/dist/types/index.d.ts.map +1 -0
  35. package/dist/types/theme.d.ts +23 -0
  36. package/dist/types/theme.d.ts.map +1 -0
  37. package/dist/utils/themeMapping.d.ts +10 -0
  38. package/dist/utils/themeMapping.d.ts.map +1 -0
  39. package/package.json +94 -0
package/README.md ADDED
@@ -0,0 +1,360 @@
1
+ # @principal-ade/panels
2
+
3
+ A modern React panel layout component library built on top of `react-resizable-panels` with enhanced animations, TypeScript support, and common layout patterns.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @principal-ade/panels
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ⚠️ **Important: You must import the CSS file for proper styling:**
14
+
15
+ ```tsx
16
+ import { AnimatedResizableLayout } from '@principal-ade/panels';
17
+ import '@principal-ade/panels/style.css'; // Required!
18
+
19
+ function App() {
20
+ return (
21
+ <AnimatedResizableLayout
22
+ leftPanel={<div>Left Content</div>}
23
+ rightPanel={<div>Right Content</div>}
24
+ collapsibleSide="left"
25
+ showCollapseButton={true}
26
+ />
27
+ );
28
+ }
29
+ ```
30
+
31
+ ## Current Implementation
32
+
33
+ We currently have an `AnimatedResizableLayout` component that provides:
34
+ - 2-panel horizontal layout (left/right)
35
+ - Smooth collapse/expand animations using requestAnimationFrame
36
+ - Collapsible panels on either side
37
+ - Dark mode support
38
+ - Custom collapse toggle button with directional icons
39
+ - Animated opacity transitions for content
40
+ - Proper handling of drag vs animation states
41
+ - Callbacks for animation lifecycle events
42
+
43
+ ### Current Features in Detail
44
+
45
+ #### Animation System
46
+ - **Smooth transitions**: 300ms cubic-bezier easing by default
47
+ - **RAF-based animations**: Custom requestAnimationFrame implementation for smooth 60fps animations
48
+ - **Dual-state handling**: Distinguishes between user dragging and programmatic animations
49
+ - **Content opacity fading**: Panel content fades during collapse/expand
50
+ - **Handle visibility**: Resize handle hides when panel is collapsed
51
+
52
+ #### Styling
53
+ - Clean, minimal resize handles (8px width)
54
+ - Hover states for interactive elements
55
+ - Dark mode support via CSS media queries
56
+ - Collapse toggle button with scaling animations on hover/active
57
+ - Shadow effects for depth perception
58
+
59
+ #### API
60
+ - `leftPanel` / `rightPanel`: ReactNode content
61
+ - `collapsibleSide`: 'left' | 'right'
62
+ - `defaultSize`: Initial panel size (0-100)
63
+ - `minSize`: Minimum size when expanded
64
+ - `collapsed`: Initial collapsed state
65
+ - `showCollapseButton`: Toggle button visibility
66
+ - `animationDuration` / `animationEasing`: Customizable animations
67
+ - Lifecycle callbacks: `onCollapseStart`, `onCollapseComplete`, `onExpandStart`, `onExpandComplete`
68
+
69
+ ## New Package Requirements
70
+
71
+ ### Core Components
72
+
73
+ #### 1. `ThreePanelLayout`
74
+ A horizontal 3-panel layout component with all panels resizable.
75
+
76
+ ```tsx
77
+ interface ThreePanelLayoutProps {
78
+ leftPanel: ReactNode;
79
+ centerPanel: ReactNode;
80
+ rightPanel: ReactNode;
81
+
82
+ // Sizing
83
+ defaultSizes?: [number, number, number]; // Default: [25, 50, 25]
84
+ minSizes?: [number, number, number]; // Default: [10, 30, 10]
85
+
86
+ // Collapsible configuration
87
+ collapsiblePanels?: {
88
+ left?: boolean;
89
+ right?: boolean;
90
+ center?: boolean; // Rarely used but supported
91
+ };
92
+
93
+ // Animation
94
+ animationDuration?: number; // Default: 300
95
+ animationEasing?: string; // Default: cubic-bezier
96
+
97
+ // Collapse state
98
+ collapsed?: {
99
+ left?: boolean;
100
+ right?: boolean;
101
+ };
102
+
103
+ // Controls
104
+ showCollapseButtons?: boolean;
105
+ collapseButtonPosition?: 'handle' | 'panel' | 'both';
106
+
107
+ // Styling
108
+ className?: string;
109
+ handleClassName?: string;
110
+ panelClassName?: string;
111
+ theme?: 'light' | 'dark' | 'auto';
112
+
113
+ // Callbacks
114
+ onPanelResize?: (sizes: [number, number, number]) => void;
115
+ onPanelCollapse?: (panel: 'left' | 'center' | 'right') => void;
116
+ onPanelExpand?: (panel: 'left' | 'center' | 'right') => void;
117
+
118
+ // Persistence
119
+ persistenceKey?: string; // Save layout to localStorage
120
+ }
121
+ ```
122
+
123
+ #### 2. `TwoPanelLayout`
124
+ A simplified 2-panel version using the native `react-resizable-panels` animations.
125
+
126
+ ```tsx
127
+ interface TwoPanelLayoutProps {
128
+ leftPanel: ReactNode;
129
+ rightPanel: ReactNode;
130
+
131
+ orientation?: 'horizontal' | 'vertical';
132
+ defaultSize?: number;
133
+ minSize?: number;
134
+
135
+ collapsibleSide?: 'left' | 'right' | 'both';
136
+ collapsed?: 'left' | 'right' | null;
137
+
138
+ // Similar animation, styling, callback props as ThreePanelLayout
139
+ }
140
+ ```
141
+
142
+ #### 3. `AdaptiveLayout`
143
+ A responsive layout that switches between layouts based on viewport size.
144
+
145
+ ```tsx
146
+ interface AdaptiveLayoutProps {
147
+ panels: ReactNode[];
148
+
149
+ breakpoints?: {
150
+ mobile?: number; // Default: 768
151
+ tablet?: number; // Default: 1024
152
+ desktop?: number; // Default: 1440
153
+ };
154
+
155
+ layouts?: {
156
+ mobile?: 'stack' | 'tabs' | 'drawer';
157
+ tablet?: 'two-panel' | 'drawer-main';
158
+ desktop?: 'three-panel' | 'two-panel';
159
+ };
160
+
161
+ // All other props from ThreePanelLayout
162
+ }
163
+ ```
164
+
165
+ ### Features to Implement
166
+
167
+ #### Must Have (v1.0)
168
+ - [x] Smooth native animations using `react-resizable-panels` built-in transitions
169
+ - [x] TypeScript definitions with strict typing
170
+ - [x] 2-panel and 3-panel layouts
171
+ - [x] Collapsible panels with animation
172
+ - [x] Dark mode support
173
+ - [x] Collapse/expand toggle buttons
174
+ - [x] Keyboard accessibility (arrow keys for resize, space/enter for toggle)
175
+ - [x] Proper ARIA labels
176
+ - [x] Zero dependencies except `react-resizable-panels`
177
+ - [x] < 10KB gzipped
178
+
179
+ #### Nice to Have (v1.1+)
180
+ - [ ] Persistence to localStorage
181
+ - [ ] Drag handle customization
182
+ - [ ] Custom collapse button components
183
+ - [ ] Snap points for panel sizes
184
+ - [ ] Double-click to reset panel size
185
+ - [ ] Nested panel support
186
+ - [ ] Vertical orientation support
187
+ - [ ] Touch gesture support for mobile
188
+ - [ ] Server-side rendering support
189
+ - [ ] Presets (sidebar layouts, dashboard layouts, etc.)
190
+
191
+ ### Technical Requirements
192
+
193
+ #### Build Setup
194
+ ```json
195
+ {
196
+ "name": "@principal-ade/panels",
197
+ "version": "1.0.0",
198
+ "main": "dist/index.js",
199
+ "module": "dist/index.esm.js",
200
+ "types": "dist/index.d.ts",
201
+ "peerDependencies": {
202
+ "react": ">=16.8.0",
203
+ "react-dom": ">=16.8.0",
204
+ "react-resizable-panels": "^2.0.0"
205
+ },
206
+ "devDependencies": {
207
+ "@storybook/react": "^7.0.0",
208
+ "typescript": "^5.0.0",
209
+ "vite": "^5.0.0"
210
+ }
211
+ }
212
+ ```
213
+
214
+ #### Storybook Stories
215
+ - Basic 2-panel layout
216
+ - Basic 3-panel layout
217
+ - Collapsible panels demo
218
+ - Dark mode toggle
219
+ - Animated collapse/expand
220
+ - Responsive adaptive layout
221
+ - Nested panels
222
+ - Custom styling examples
223
+ - Persistence demo
224
+ - Accessibility demo
225
+
226
+ ### Migration Guide from Current Implementation
227
+
228
+ #### Key Differences
229
+ 1. **Use native `react-resizable-panels` animations** instead of custom RAF implementation
230
+ 2. **Support 3 panels** out of the box
231
+ 3. **Simplified API** - less boilerplate needed
232
+ 4. **Better TypeScript support** with generics for panel content types
233
+ 5. **Built-in persistence** via localStorage
234
+ 6. **Responsive layouts** with AdaptiveLayout component
235
+
236
+ #### Migration Steps
237
+ ```tsx
238
+ // Old
239
+ import { AnimatedResizableLayout } from './layout-components';
240
+
241
+ <AnimatedResizableLayout
242
+ leftPanel={<Sidebar />}
243
+ rightPanel={<MainContent />}
244
+ collapsibleSide="left"
245
+ defaultSize={25}
246
+ showCollapseButton={true}
247
+ />
248
+
249
+ // New
250
+ import { TwoPanelLayout } from '@principal-ade/panels';
251
+
252
+ <TwoPanelLayout
253
+ leftPanel={<Sidebar />}
254
+ rightPanel={<MainContent />}
255
+ collapsibleSide="left"
256
+ defaultSize={25}
257
+ showCollapseButtons={true}
258
+ />
259
+ ```
260
+
261
+ ### Example Usage
262
+
263
+ #### Basic 3-Panel Layout
264
+ ```tsx
265
+ import { ThreePanelLayout } from '@principal-ade/panels';
266
+
267
+ function App() {
268
+ return (
269
+ <ThreePanelLayout
270
+ leftPanel={<Navigation />}
271
+ centerPanel={<MainContent />}
272
+ rightPanel={<Sidebar />}
273
+ defaultSizes={[20, 60, 20]}
274
+ collapsiblePanels={{ left: true, right: true }}
275
+ showCollapseButtons
276
+ theme="auto"
277
+ persistenceKey="app-layout"
278
+ />
279
+ );
280
+ }
281
+ ```
282
+
283
+ #### Responsive Adaptive Layout
284
+ ```tsx
285
+ import { AdaptiveLayout } from '@principal-ade/panels';
286
+
287
+ function App() {
288
+ return (
289
+ <AdaptiveLayout
290
+ panels={[<Nav />, <Main />, <Side />]}
291
+ layouts={{
292
+ mobile: 'drawer',
293
+ tablet: 'two-panel',
294
+ desktop: 'three-panel'
295
+ }}
296
+ />
297
+ );
298
+ }
299
+ ```
300
+
301
+ ### Development Workflow
302
+
303
+ 1. **Setup**: Clone repo, install dependencies
304
+ 2. **Development**: Run Storybook for component development
305
+ 3. **Testing**: Unit tests with React Testing Library
306
+ 4. **Build**: Vite for bundling
307
+ 5. **Publish**: NPM with proper versioning
308
+
309
+ ### API Design Principles
310
+
311
+ 1. **Progressive disclosure**: Simple use cases should be simple
312
+ 2. **Sensible defaults**: Works well out of the box
313
+ 3. **Composition over configuration**: Prefer component composition
314
+ 4. **Type safety**: Full TypeScript support with inference
315
+ 5. **Performance**: Use native browser APIs and React features
316
+ 6. **Accessibility**: WCAG 2.1 AA compliance
317
+
318
+ ### Browser Support
319
+
320
+ - Chrome/Edge 90+
321
+ - Firefox 90+
322
+ - Safari 14+
323
+ - Mobile browsers (iOS Safari, Chrome Android)
324
+
325
+ ### License
326
+
327
+ MIT
328
+
329
+ ---
330
+
331
+ ## Implementation Notes for Developer
332
+
333
+ ### Priority Order
334
+ 1. Start with `TwoPanelLayout` to replace current implementation
335
+ 2. Extend to `ThreePanelLayout` with similar API
336
+ 3. Add `AdaptiveLayout` for responsive designs
337
+ 4. Create comprehensive Storybook stories
338
+ 5. Add unit tests
339
+ 6. Setup CI/CD pipeline
340
+ 7. Publish to NPM
341
+
342
+ ### Key Technical Decisions
343
+ - Use `react-resizable-panels` v2+ for native collapse animations
344
+ - Avoid custom RAF logic - the library handles this now
345
+ - Use CSS modules or styled-components for styling isolation
346
+ - Implement with hooks only (no class components)
347
+ - Use React.memo for performance optimization
348
+ - Provide both controlled and uncontrolled modes
349
+
350
+ ### Testing Checklist
351
+ - [ ] Keyboard navigation works
352
+ - [ ] Screen readers announce panel states
353
+ - [ ] Animations are smooth at 60fps
354
+ - [ ] No memory leaks on unmount
355
+ - [ ] Works with React 18 concurrent features
356
+ - [ ] SSR compatible (no window references in initial render)
357
+ - [ ] Touch gestures work on mobile
358
+ - [ ] Resize observer cleanup
359
+ - [ ] Dark mode transitions smoothly
360
+ - [ ] localStorage persistence handles edge cases
@@ -0,0 +1,42 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { Theme } from '@principal-ade/industry-theme';
3
+ export interface AnimatedResizableLayoutProps {
4
+ /** Content for the left panel */
5
+ leftPanel: ReactNode;
6
+ /** Content for the right panel */
7
+ rightPanel: ReactNode;
8
+ /** Which side is collapsible */
9
+ collapsibleSide?: 'left' | 'right';
10
+ /** Default size of the collapsible panel (0-100) */
11
+ defaultSize?: number;
12
+ /** Minimum size of the collapsible panel when expanded (0-100) */
13
+ minSize?: number;
14
+ /** CSS class for the layout container */
15
+ className?: string;
16
+ /** Whether the panel is initially collapsed */
17
+ collapsed?: boolean;
18
+ /** Additional styles to apply to the container */
19
+ style?: React.CSSProperties;
20
+ /** Whether to show the collapse/expand toggle button */
21
+ showCollapseButton?: boolean;
22
+ /** Animation duration in milliseconds */
23
+ animationDuration?: number;
24
+ /** Animation easing function */
25
+ animationEasing?: string;
26
+ /** Callback fired when collapse starts */
27
+ onCollapseStart?: () => void;
28
+ /** Callback fired when collapse completes */
29
+ onCollapseComplete?: () => void;
30
+ /** Callback fired when expand starts */
31
+ onExpandStart?: () => void;
32
+ /** Callback fired when expand completes */
33
+ onExpandComplete?: () => void;
34
+ /** Theme object for customizing colors */
35
+ theme: Theme;
36
+ }
37
+ /**
38
+ * AnimatedResizableLayout - Combines react-resizable-panels with smooth animations
39
+ * Supports both manual dragging to resize AND smooth animations for collapse/expand
40
+ */
41
+ export declare const AnimatedResizableLayout: React.FC<AnimatedResizableLayoutProps>;
42
+ //# sourceMappingURL=AnimatedResizableLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedResizableLayout.d.ts","sourceRoot":"","sources":["../../src/components/AnimatedResizableLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AAOnF,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEtD,OAAO,+BAA+B,CAAC;AAEvC,MAAM,WAAW,4BAA4B;IAC3C,iCAAiC;IACjC,SAAS,EAAE,SAAS,CAAC;IAErB,kCAAkC;IAClC,UAAU,EAAE,SAAS,CAAC;IAEtB,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEnC,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,kDAAkD;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,wDAAwD;IACxD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAE7B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAEhC,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B,2CAA2C;IAC3C,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAE9B,0CAA0C;IAC1C,KAAK,EAAE,KAAK,CAAC;CACd;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA2Q1E,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { Theme } from '@principal-ade/industry-theme';
3
+ export interface AnimatedVerticalLayoutProps {
4
+ /** Content for the top panel */
5
+ topPanel: ReactNode;
6
+ /** Content for the bottom panel */
7
+ bottomPanel: ReactNode;
8
+ /** Which panels are collapsible */
9
+ collapsiblePanels?: {
10
+ top?: boolean;
11
+ bottom?: boolean;
12
+ };
13
+ /** Default sizes for each panel (0-100) */
14
+ defaultSizes?: {
15
+ top: number;
16
+ bottom: number;
17
+ };
18
+ /** Minimum sizes for each panel when expanded (0-100) */
19
+ minSizes?: {
20
+ top: number;
21
+ bottom: number;
22
+ };
23
+ /** CSS class for the layout container */
24
+ className?: string;
25
+ /** Initial collapsed state for panels */
26
+ collapsed?: {
27
+ top?: boolean;
28
+ bottom?: boolean;
29
+ };
30
+ /** Additional styles to apply to the container */
31
+ style?: React.CSSProperties;
32
+ /** Whether to show the collapse/expand toggle buttons */
33
+ showCollapseButtons?: boolean;
34
+ /** Animation duration in milliseconds */
35
+ animationDuration?: number;
36
+ /** Animation easing function */
37
+ animationEasing?: string;
38
+ /** Theme object for customizing colors */
39
+ theme: Theme;
40
+ /** Callbacks for panel events */
41
+ onTopCollapseStart?: () => void;
42
+ onTopCollapseComplete?: () => void;
43
+ onTopExpandStart?: () => void;
44
+ onTopExpandComplete?: () => void;
45
+ onBottomCollapseStart?: () => void;
46
+ onBottomCollapseComplete?: () => void;
47
+ onBottomExpandStart?: () => void;
48
+ onBottomExpandComplete?: () => void;
49
+ onPanelResize?: (sizes: {
50
+ top: number;
51
+ bottom: number;
52
+ }) => void;
53
+ }
54
+ /**
55
+ * AnimatedVerticalLayout - Vertical version with both panels independently collapsible
56
+ * Supports both manual dragging to resize AND smooth animations for collapse/expand
57
+ */
58
+ export declare const AnimatedVerticalLayout: React.FC<AnimatedVerticalLayoutProps>;
59
+ //# sourceMappingURL=AnimatedVerticalLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnimatedVerticalLayout.d.ts","sourceRoot":"","sources":["../../src/components/AnimatedVerticalLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AAOnF,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEtD,OAAO,8BAA8B,CAAC;AAEtC,MAAM,WAAW,2BAA2B;IAC1C,gCAAgC;IAChC,QAAQ,EAAE,SAAS,CAAC;IAEpB,mCAAmC;IACnC,WAAW,EAAE,SAAS,CAAC;IAEvB,mCAAmC;IACnC,iBAAiB,CAAC,EAAE;QAClB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IAEF,2CAA2C;IAC3C,YAAY,CAAC,EAAE;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,yDAAyD;IACzD,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,SAAS,CAAC,EAAE;QACV,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IAEF,kDAAkD;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,yDAAyD;IACzD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,0CAA0C;IAC1C,KAAK,EAAE,KAAK,CAAC;IAEb,iCAAiC;IACjC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClE;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAuYxE,CAAC"}
@@ -0,0 +1,87 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { Theme } from '@principal-ade/industry-theme';
3
+ import { PanelLayout } from './PanelConfigurator';
4
+ export interface PanelDefinitionWithContent {
5
+ id: string;
6
+ label: string;
7
+ content: ReactNode;
8
+ preview?: ReactNode;
9
+ icon?: ReactNode;
10
+ }
11
+ export interface ConfigurablePanelLayoutProps {
12
+ /** Available panels with their content */
13
+ panels: PanelDefinitionWithContent[];
14
+ /** Current layout configuration - omit or set positions to null/undefined for two-panel layouts */
15
+ layout: PanelLayout;
16
+ /** Custom data attributes for slot identification (for edit mode) */
17
+ slotDataAttributes?: {
18
+ left?: Record<string, string>;
19
+ middle?: Record<string, string>;
20
+ right?: Record<string, string>;
21
+ };
22
+ /** Which panels are collapsible - only specify for active panels */
23
+ collapsiblePanels?: {
24
+ left?: boolean;
25
+ middle?: boolean;
26
+ right?: boolean;
27
+ };
28
+ /** Default sizes for each panel (0-100, should sum to 100 for active panels) - only specify for active panels */
29
+ defaultSizes?: {
30
+ left?: number;
31
+ middle?: number;
32
+ right?: number;
33
+ };
34
+ /** Minimum sizes for each panel when expanded (0-100) - only specify for active panels */
35
+ minSizes?: {
36
+ left?: number;
37
+ middle?: number;
38
+ right?: number;
39
+ };
40
+ /** CSS class for the layout container */
41
+ className?: string;
42
+ /** Initial collapsed state for panels */
43
+ collapsed?: {
44
+ left?: boolean;
45
+ middle?: boolean;
46
+ right?: boolean;
47
+ };
48
+ /** Additional styles to apply to the container */
49
+ style?: React.CSSProperties;
50
+ /** Whether to show collapse/expand toggle buttons */
51
+ showCollapseButtons?: boolean;
52
+ /** Animation duration in milliseconds */
53
+ animationDuration?: number;
54
+ /** Animation easing function */
55
+ animationEasing?: string;
56
+ /** Theme object for customizing colors */
57
+ theme: Theme;
58
+ /** Callbacks for panel events */
59
+ onLeftCollapseStart?: () => void;
60
+ onLeftCollapseComplete?: () => void;
61
+ onLeftExpandStart?: () => void;
62
+ onLeftExpandComplete?: () => void;
63
+ onMiddleCollapseStart?: () => void;
64
+ onMiddleCollapseComplete?: () => void;
65
+ onMiddleExpandStart?: () => void;
66
+ onMiddleExpandComplete?: () => void;
67
+ onRightCollapseStart?: () => void;
68
+ onRightCollapseComplete?: () => void;
69
+ onRightExpandStart?: () => void;
70
+ onRightExpandComplete?: () => void;
71
+ onPanelResize?: (sizes: {
72
+ left: number;
73
+ middle: number;
74
+ right: number;
75
+ }) => void;
76
+ }
77
+ /**
78
+ * ConfigurablePanelLayout - A flexible panel layout that supports 2 or 3 panels
79
+ *
80
+ * Supports both two-panel and three-panel layouts:
81
+ * - For two panels: omit or set unused positions to null/undefined (e.g., { left: 'panel1', right: 'panel2' })
82
+ * - For three panels: define all positions (e.g., { left: 'panel1', middle: 'panel2', right: 'panel3' })
83
+ *
84
+ * The component automatically adjusts sizing and behavior based on active panels.
85
+ */
86
+ export declare const ConfigurablePanelLayout: React.FC<ConfigurablePanelLayoutProps>;
87
+ //# sourceMappingURL=ConfigurablePanelLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigurablePanelLayout.d.ts","sourceRoot":"","sources":["../../src/components/ConfigurablePanelLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAC;AASnF,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAuD,MAAM,qBAAqB,CAAC;AAEvG,OAAO,+BAA+B,CAAC;AAEvC,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,4BAA4B;IAC3C,0CAA0C;IAC1C,MAAM,EAAE,0BAA0B,EAAE,CAAC;IAErC,mGAAmG;IACnG,MAAM,EAAE,WAAW,CAAC;IAEpB,qEAAqE;IACrE,kBAAkB,CAAC,EAAE;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAChC,CAAC;IAEF,oEAAoE;IACpE,iBAAiB,CAAC,EAAE;QAClB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF,iHAAiH;IACjH,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,0FAA0F;IAC1F,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,yCAAyC;IACzC,SAAS,CAAC,EAAE;QACV,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;IAEF,kDAAkD;IAClD,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,qDAAqD;IACrD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,0CAA0C;IAC1C,KAAK,EAAE,KAAK,CAAC;IAEb,iCAAiC;IACjC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAClF;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,4BAA4B,CA+/B1E,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { ConfigurablePanelLayoutProps } from './ConfigurablePanelLayout';
3
+ import { PanelLayout, PanelDefinition } from './PanelConfigurator';
4
+ export interface EditableConfigurablePanelLayoutProps extends ConfigurablePanelLayoutProps {
5
+ /** Whether edit mode is enabled (controlled) */
6
+ isEditMode: boolean;
7
+ /** Callback when layout changes in edit mode */
8
+ onLayoutChange?: (layout: PanelLayout) => void;
9
+ /** Available panels for drag-and-drop */
10
+ availablePanels?: PanelDefinition[];
11
+ }
12
+ /**
13
+ * EditableConfigurablePanelLayout - Wrapper component that adds iPhone-style edit mode
14
+ * Allows dragging entire slot sections (left/middle/right) to rearrange them
15
+ */
16
+ export declare const EditableConfigurablePanelLayout: React.FC<EditableConfigurablePanelLayoutProps>;
17
+ //# sourceMappingURL=EditableConfigurablePanelLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditableConfigurablePanelLayout.d.ts","sourceRoot":"","sources":["../../src/components/EditableConfigurablePanelLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAa3E,OAAO,EAA2B,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,2BAA2B,CAAC;AAEnC,MAAM,WAAW,oCAAqC,SAAQ,4BAA4B;IACxF,gDAAgD;IAChD,UAAU,EAAE,OAAO,CAAC;IAEpB,gDAAgD;IAChD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAE/C,yCAAyC;IACzC,eAAe,CAAC,EAAE,eAAe,EAAE,CAAC;CACrC;AAgED;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,KAAK,CAAC,EAAE,CAAC,oCAAoC,CA+H1F,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { default as React } from 'react';
2
+ import { Theme } from '@principal-ade/industry-theme';
3
+ export interface PanelDefinition {
4
+ id: string;
5
+ label: string;
6
+ preview?: React.ReactNode;
7
+ icon?: React.ReactNode;
8
+ }
9
+ export type PanelSlot = string | null | PanelGroup;
10
+ export interface PanelGroup {
11
+ type: 'tabs' | 'tiles';
12
+ panels: string[];
13
+ config?: TabsConfig | TilesConfig;
14
+ }
15
+ export interface TabsConfig {
16
+ defaultActiveTab?: number;
17
+ tabPosition?: 'top' | 'bottom' | 'left' | 'right';
18
+ centered?: boolean;
19
+ hideTabList?: boolean;
20
+ activeTabIndex?: number;
21
+ onTabChange?: (index: number) => void;
22
+ }
23
+ export interface TilesConfig {
24
+ direction?: 'horizontal' | 'vertical' | 'grid';
25
+ columns?: number;
26
+ rows?: number;
27
+ tileSizes?: number[];
28
+ }
29
+ export interface PanelLayout {
30
+ left?: PanelSlot;
31
+ middle?: PanelSlot;
32
+ right?: PanelSlot;
33
+ }
34
+ export interface PanelConfiguratorProps {
35
+ /** Available panels that can be placed in slots */
36
+ availablePanels: PanelDefinition[];
37
+ /** Current layout configuration */
38
+ currentLayout: PanelLayout;
39
+ /** Callback when layout changes */
40
+ onChange: (layout: PanelLayout) => void;
41
+ /** Optional class name for the container */
42
+ className?: string;
43
+ /** Optional theme override (uses context theme by default) */
44
+ theme?: Theme;
45
+ }
46
+ /**
47
+ * PanelConfigurator - Interactive UI for configuring panel layout
48
+ *
49
+ * Interaction modes:
50
+ * - Click slot → click panel: Assigns panel to slot
51
+ * - Click panel → click slot: Assigns panel to slot
52
+ * - Click slot → click slot: Swaps their content
53
+ */
54
+ export declare const PanelConfigurator: React.FC<PanelConfiguratorProps>;
55
+ //# sourceMappingURL=PanelConfigurator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelConfigurator.d.ts","sourceRoot":"","sources":["../../src/components/PanelConfigurator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AACrD,OAAO,EAAY,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,yBAAyB,CAAC;AAEjC,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,IAAI,GACJ,UAAU,CAAC;AAEf,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACnC;AAED,MAAM,WAAW,UAAU;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAClD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IAGtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,mDAAmD;IACnD,eAAe,EAAE,eAAe,EAAE,CAAC;IAEnC,mCAAmC;IACnC,aAAa,EAAE,WAAW,CAAC;IAE3B,mCAAmC;IACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IAExC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,8DAA8D;IAC9D,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAkBD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAua9D,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { ConfigurablePanelLayoutProps } from './ConfigurablePanelLayout';
3
+ import { SnapCarouselProps } from './SnapCarousel';
4
+ export interface ResponsiveConfigurablePanelLayoutProps extends ConfigurablePanelLayoutProps {
5
+ /**
6
+ * Media query used to determine when to switch to the mobile carousel layout.
7
+ * Defaults to `(max-width: 768px)`.
8
+ */
9
+ mobileBreakpoint?: string;
10
+ /**
11
+ * Additional props passed to the SnapCarousel when the mobile layout is active.
12
+ * The `panels` and `theme` props are managed by this component.
13
+ */
14
+ mobileCarouselProps?: Omit<SnapCarouselProps, 'panels' | 'theme'>;
15
+ }
16
+ /**
17
+ * ResponsiveConfigurablePanelLayout - Renders ConfigurablePanelLayout on desktop widths
18
+ * and automatically swaps to a SnapCarousel-powered experience on mobile.
19
+ */
20
+ export declare const ResponsiveConfigurablePanelLayout: React.FC<ResponsiveConfigurablePanelLayoutProps>;
21
+ //# sourceMappingURL=ResponsiveConfigurablePanelLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponsiveConfigurablePanelLayout.d.ts","sourceRoot":"","sources":["../../src/components/ResponsiveConfigurablePanelLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAA2B,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAGlG,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGjE,MAAM,WAAW,sCAAuC,SAAQ,4BAA4B;IAC1F;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC;CACnE;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,EAAE,CAAC,sCAAsC,CAsE9F,CAAC"}