@thangdevalone/meeting-grid-layout-react 1.4.1

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/LICENSE ADDED
@@ -0,0 +1,44 @@
1
+ MIT License with Attribution Requirement
2
+
3
+ Copyright (c) 2024-2026 ThangDevAlone
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ 1. The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ 2. ATTRIBUTION REQUIREMENT: Any project using this Software must include
16
+ visible attribution to the original author in one of the following ways:
17
+
18
+ a) In the project's README or documentation file, include:
19
+ "This project uses meet-layout-grid by @thangdevalone
20
+ (https://github.com/thangdevalone/meet-layout-grid)"
21
+
22
+ b) In an "About" or "Credits" section of the application, include:
23
+ "Powered by meet-layout-grid - https://github.com/thangdevalone/meet-layout-grid"
24
+
25
+ c) In the project's package.json or equivalent dependency manifest, ensure
26
+ the package is listed with its original name and author information intact.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
+ SOFTWARE.
35
+
36
+ ---
37
+
38
+ TL;DR - Bạn được phép:
39
+ ✅ Sử dụng miễn phí cho dự án cá nhân và thương mại
40
+ ✅ Chỉnh sửa và phân phối lại
41
+ ✅ Sử dụng trong các dự án closed-source
42
+
43
+ Yêu cầu duy nhất:
44
+ 📝 Ghi nguồn/credit cho tác giả gốc trong README hoặc phần About của dự án
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # @thangdevalone/meeting-grid-layout-react
2
+
3
+ React 18+ bindings for meeting-grid-layout with Motion animations.
4
+
5
+ > For full documentation, layout modes, and API reference, see the [main README](https://github.com/thangdevalone/meeting-grid-layout#readme).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @thangdevalone/meeting-grid-layout-react
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```tsx
16
+ import { GridContainer, GridItem } from '@thangdevalone/meeting-grid-layout-react'
17
+
18
+ function MeetingGrid({ participants }) {
19
+ return (
20
+ <GridContainer aspectRatio="16:9" gap={8} layoutMode="gallery" count={participants.length}>
21
+ {participants.map((p, index) => (
22
+ <GridItem key={p.id} index={index}>
23
+ <VideoTile participant={p} />
24
+ </GridItem>
25
+ ))}
26
+ </GridContainer>
27
+ )
28
+ }
29
+ ```
30
+
31
+ ## Components
32
+
33
+ ### `<GridContainer>`
34
+
35
+ Wraps the grid, computes layout, and provides context to children.
36
+
37
+ | Prop | Type | Default | Description |
38
+ | -------------------- | ----------------------------------------- | ----------- | -------------------------------------------------------------------- |
39
+ | `aspectRatio` | `string` | `'16:9'` | Default tile aspect ratio |
40
+ | `gap` | `number` | `8` | Gap between tiles (px) |
41
+ | `count` | `number` | required | Number of items |
42
+ | `layoutMode` | `LayoutMode` | `'gallery'` | `gallery` \| `spotlight` |
43
+ | `pinnedIndex` | `number` | - | Pinned participant index |
44
+ | `othersPosition` | `'left' \| 'right' \| 'top' \| 'bottom'` | `'right'` | Thumbnail position in pin mode |
45
+ | `springPreset` | `SpringPreset` | `'smooth'` | Animation preset |
46
+ | `maxItemsPerPage` | `number` | - | Max items per page |
47
+ | `currentPage` | `number` | `0` | Current page |
48
+ | `maxVisible` | `number` | - | Max visible in others area |
49
+ | `currentVisiblePage` | `number` | `0` | Current page for visible items (when maxVisible > 0) |
50
+ | `itemAspectRatios` | `(ItemAspectRatio \| undefined)[]` | - | Per-item aspect ratios |
51
+ | `floatWidth` | `number` | - | Width of the auto-float PiP (2-person mode). Overrides breakpoints. |
52
+ | `floatHeight` | `number` | - | Height of the auto-float PiP (2-person mode). Overrides breakpoints. |
53
+ | `floatBreakpoints` | `PipBreakpoint[]` | - | Responsive breakpoints for auto-float PiP (see [Responsive PiP](#responsive-pip)) |
54
+
55
+ ### `<GridItem>`
56
+
57
+ Single grid cell with Motion layout animation.
58
+
59
+ | Prop | Type | Default | Description |
60
+ | ------------------ | ----------------- | -------- | ----------------------------------------------- |
61
+ | `index` | `number` | required | Item index |
62
+ | `disableAnimation` | `boolean` | `false` | Disable layout animation |
63
+ | `itemAspectRatio` | `ItemAspectRatio` | - | Per-item aspect ratio (overrides container) |
64
+ | `transition` | `Transition` | - | Custom Motion transition override |
65
+ | `className` | `string` | - | Additional CSS class name |
66
+ | `style` | `CSSProperties` | - | Custom style (merged with animated styles) |
67
+
68
+ Render prop: `{({ contentDimensions, isLastVisibleOther, hiddenCount, isFloat }) => ...}`
69
+
70
+ ### `<FloatingGridItem>`
71
+
72
+ Draggable Picture-in-Picture overlay with corner snapping.
73
+
74
+ | Prop | Type | Default | Description |
75
+ | ----------------- | ------------------------------------------------------------- | -------------------------------- | ------------------------------------------------ |
76
+ | `children` | `ReactNode` | required | Content to render inside the floating item |
77
+ | `width` | `number` | `120` | Floating item width (px). Overridden by `breakpoints`. |
78
+ | `height` | `number` | `160` | Floating item height (px). Overridden by `breakpoints`. |
79
+ | `breakpoints` | `PipBreakpoint[]` | - | Responsive breakpoints (see [Responsive PiP](#responsive-pip)) |
80
+ | `initialPosition` | `{ x: number; y: number }` | `{ x: 16, y: 16 }` | Extra offset from anchor corner |
81
+ | `anchor` | `'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `'bottom-right'` | Which corner to snap/anchor the item |
82
+ | `visible` | `boolean` | `true` | Whether the floating item is visible |
83
+ | `edgePadding` | `number` | `12` | Minimum padding from container edges (px) |
84
+ | `onAnchorChange` | `(anchor) => void` | - | Callback when anchor corner changes after drag |
85
+ | `transition` | `Transition` | `spring (stiffness 400, damping 30)` | Custom Motion transition for snap animation |
86
+ | `borderRadius` | `number` | `12` | Border radius of the floating item (px) |
87
+ | `boxShadow` | `string` | `'0 4px 20px rgba(0,0,0,0.3)'` | CSS box-shadow of the floating item |
88
+ | `className` | `string` | - | Additional CSS class name |
89
+ | `style` | `CSSProperties` | - | Custom style (merged with floating styles) |
90
+
91
+ ### `<GridOverlay>`
92
+
93
+ Full-grid overlay for screen sharing, whiteboard, etc.
94
+
95
+ | Prop | Type | Default | Description |
96
+ | ----------------- | ----------- | ---------------------- | ------------------------ |
97
+ | `visible` | `boolean` | `true` | Show/hide the overlay |
98
+ | `backgroundColor` | `string` | `'rgba(0,0,0,0.5)'` | Overlay background color |
99
+ | `children` | `ReactNode` | - | Content inside overlay |
100
+
101
+ ## Responsive PiP
102
+
103
+ PiP supports responsive breakpoints that auto-adjust size based on container width.
104
+
105
+ ```tsx
106
+ import { FloatingGridItem, DEFAULT_FLOAT_BREAKPOINTS } from '@thangdevalone/meet-layout-grid-react'
107
+
108
+ // Standalone FloatingGridItem — auto-responsive
109
+ <FloatingGridItem breakpoints={DEFAULT_FLOAT_BREAKPOINTS}>
110
+ <VideoTile />
111
+ </FloatingGridItem>
112
+
113
+ // Auto-float in 2-person mode — responsive PiP via GridContainer
114
+ <GridContainer count={2} floatBreakpoints={DEFAULT_FLOAT_BREAKPOINTS}>
115
+ {participants.map((p, i) => (
116
+ <GridItem key={p.id} index={i}><VideoTile participant={p} /></GridItem>
117
+ ))}
118
+ </GridContainer>
119
+ ```
120
+
121
+ Resolve PiP size programmatically:
122
+
123
+ ```ts
124
+ import { resolveFloatSize, DEFAULT_FLOAT_BREAKPOINTS } from '@thangdevalone/meet-layout-grid-react'
125
+
126
+ const size = resolveFloatSize(800, DEFAULT_FLOAT_BREAKPOINTS)
127
+ // → { width: 160, height: 215 }
128
+ ```
129
+
130
+ > See the [main README](https://github.com/thangdevalone/meet-layout-grid#responsive-pip) for full details, default breakpoint table, and custom breakpoint examples.
131
+
132
+ ## Hooks
133
+
134
+ | Hook | Description |
135
+ | ------------------------ | ----------------------------------------- |
136
+ | `useGridDimensions(ref)` | Track element size via ResizeObserver |
137
+ | `useMeetGrid(options)` | Compute grid layout programmatically |
138
+ | `useGridContext()` | Access grid context from child components |
139
+ | `useGridAnimation()` | Access animation config from context |
140
+
141
+ ## Re-exported from Core
142
+
143
+ | Export | Type | Description |
144
+ | --------------------------- | ---------- | ------------------------------------------------ |
145
+ | `createMeetGrid` | function | Create grid layout (Vanilla JS) |
146
+ | `createGrid` | function | Low-level grid computation |
147
+ | `resolveFloatSize` | function | Resolve PiP size for a given container width |
148
+ | `DEFAULT_FLOAT_BREAKPOINTS` | constant | Ready-made 5-level responsive PiP breakpoints |
149
+ | `getSpringConfig` | function | Get spring config from preset name |
150
+ | `springPresets` | object | All spring presets |
151
+ | `getAspectRatio` | function | Parse aspect ratio string |
152
+ | `PipBreakpoint` | type | Breakpoint definition type |
153
+ | `PaginationInfo` | type | Pagination info type |
154
+ | `ContentDimensions` | type | Content dimensions with offset |
155
+
156
+ ## License
157
+
158
+ MIT