@nuralyui/panel 0.0.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/README.md +218 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Panel Component
|
|
2
|
+
|
|
3
|
+
A versatile panel component that can transform between docked panel and floating window modes. Perfect for tool palettes, settings panels, chat windows, and any UI that needs flexible positioning.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Dual Mode**: Transform between panel (docked) and window (floating) modes
|
|
8
|
+
- **Draggable**: Drag windows around the screen (window mode only)
|
|
9
|
+
- **Resizable**: Resize panels dynamically with drag handles
|
|
10
|
+
- **Collapsible**: Collapse/expand panel content
|
|
11
|
+
- **Minimizable**: Minimize to compact view
|
|
12
|
+
- **Multiple Positions**: Dock to left, right, top, or bottom (panel mode)
|
|
13
|
+
- **Size Presets**: Small, medium, large, or custom dimensions
|
|
14
|
+
- **Theme Support**: Light and dark mode compatible
|
|
15
|
+
- **Customizable**: Header, footer, and body slots
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @nuralyui/panel
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Basic Usage
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<!-- Docked panel -->
|
|
27
|
+
<nr-panel
|
|
28
|
+
title="Settings"
|
|
29
|
+
icon="settings"
|
|
30
|
+
mode="panel"
|
|
31
|
+
position="right"
|
|
32
|
+
size="medium">
|
|
33
|
+
<p>Panel content here</p>
|
|
34
|
+
</nr-panel>
|
|
35
|
+
|
|
36
|
+
<!-- Floating window -->
|
|
37
|
+
<nr-panel
|
|
38
|
+
title="Tool Window"
|
|
39
|
+
mode="window"
|
|
40
|
+
draggable
|
|
41
|
+
resizable
|
|
42
|
+
size="medium">
|
|
43
|
+
<p>Window content here</p>
|
|
44
|
+
</nr-panel>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Props
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Default | Description |
|
|
50
|
+
|------|------|---------|-------------|
|
|
51
|
+
| `mode` | `'panel' \| 'window' \| 'minimized'` | `'panel'` | Panel display mode |
|
|
52
|
+
| `size` | `'small' \| 'medium' \| 'large' \| 'custom'` | `'medium'` | Panel size preset |
|
|
53
|
+
| `position` | `'left' \| 'right' \| 'top' \| 'bottom'` | `'right'` | Panel position (panel mode only) |
|
|
54
|
+
| `draggable` | `boolean` | `true` | Whether the panel can be dragged (window mode only) |
|
|
55
|
+
| `resizable` | `boolean` | `false` | Whether the panel is resizable |
|
|
56
|
+
| `collapsible` | `boolean` | `false` | Whether the panel content can be collapsed |
|
|
57
|
+
| `minimizable` | `boolean` | `true` | Whether the panel can be minimized |
|
|
58
|
+
| `closable` | `boolean` | `true` | Whether the panel can be closed |
|
|
59
|
+
| `title` | `string` | `''` | Panel title |
|
|
60
|
+
| `icon` | `string` | `''` | Header icon name |
|
|
61
|
+
| `width` | `string` | `''` | Custom width (CSS value) |
|
|
62
|
+
| `height` | `string` | `''` | Custom height (CSS value) |
|
|
63
|
+
| `open` | `boolean` | `true` | Whether the panel is visible |
|
|
64
|
+
|
|
65
|
+
## Events
|
|
66
|
+
|
|
67
|
+
| Event | Detail | Description |
|
|
68
|
+
|-------|--------|-------------|
|
|
69
|
+
| `panel-mode-change` | `{ mode, previousMode }` | Fired when panel mode changes |
|
|
70
|
+
| `panel-close` | `void` | Fired when panel is closed |
|
|
71
|
+
| `panel-minimize` | `void` | Fired when panel is minimized |
|
|
72
|
+
| `panel-maximize` | `void` | Fired when panel is maximized/restored |
|
|
73
|
+
| `panel-drag-start` | `{ x, y }` | Fired when panel drag starts |
|
|
74
|
+
| `panel-drag-end` | `{ x, y }` | Fired when panel drag ends |
|
|
75
|
+
| `panel-resize` | `{ width, height }` | Fired when panel is resized |
|
|
76
|
+
|
|
77
|
+
## Slots
|
|
78
|
+
|
|
79
|
+
| Slot | Description |
|
|
80
|
+
|------|-------------|
|
|
81
|
+
| `default` | Panel body content |
|
|
82
|
+
| `header` | Custom header content (replaces title) |
|
|
83
|
+
| `footer` | Custom footer content |
|
|
84
|
+
|
|
85
|
+
## Methods
|
|
86
|
+
|
|
87
|
+
| Method | Description |
|
|
88
|
+
|--------|-------------|
|
|
89
|
+
| `transformToWindow()` | Transform panel to window mode |
|
|
90
|
+
| `transformToPanel()` | Transform panel to panel mode |
|
|
91
|
+
| `minimize()` | Minimize panel |
|
|
92
|
+
| `maximize()` | Maximize/restore panel |
|
|
93
|
+
| `close()` | Close panel |
|
|
94
|
+
| `toggleCollapse()` | Toggle collapsed state |
|
|
95
|
+
|
|
96
|
+
## Examples
|
|
97
|
+
|
|
98
|
+
### Chat Panel
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<nr-panel
|
|
102
|
+
title="Team Chat"
|
|
103
|
+
icon="message-circle"
|
|
104
|
+
mode="panel"
|
|
105
|
+
position="right"
|
|
106
|
+
size="small">
|
|
107
|
+
<div class="chat-messages">
|
|
108
|
+
<!-- Chat messages -->
|
|
109
|
+
</div>
|
|
110
|
+
<div slot="footer">
|
|
111
|
+
<input type="text" placeholder="Type a message...">
|
|
112
|
+
</div>
|
|
113
|
+
</nr-panel>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Draggable Tool Window
|
|
117
|
+
|
|
118
|
+
```html
|
|
119
|
+
<nr-panel
|
|
120
|
+
title="Color Picker"
|
|
121
|
+
icon="droplet"
|
|
122
|
+
mode="window"
|
|
123
|
+
draggable
|
|
124
|
+
resizable
|
|
125
|
+
size="small">
|
|
126
|
+
<div class="color-palette">
|
|
127
|
+
<!-- Color picker UI -->
|
|
128
|
+
</div>
|
|
129
|
+
</nr-panel>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Settings Panel with Footer
|
|
133
|
+
|
|
134
|
+
```html
|
|
135
|
+
<nr-panel
|
|
136
|
+
title="Preferences"
|
|
137
|
+
icon="settings"
|
|
138
|
+
mode="panel"
|
|
139
|
+
position="left"
|
|
140
|
+
collapsible
|
|
141
|
+
size="medium">
|
|
142
|
+
<div class="settings-form">
|
|
143
|
+
<!-- Settings controls -->
|
|
144
|
+
</div>
|
|
145
|
+
<div slot="footer">
|
|
146
|
+
<button>Cancel</button>
|
|
147
|
+
<button>Save</button>
|
|
148
|
+
</div>
|
|
149
|
+
</nr-panel>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Console Output Panel
|
|
153
|
+
|
|
154
|
+
```html
|
|
155
|
+
<nr-panel
|
|
156
|
+
title="Console"
|
|
157
|
+
icon="terminal"
|
|
158
|
+
mode="panel"
|
|
159
|
+
position="bottom"
|
|
160
|
+
collapsible
|
|
161
|
+
size="medium">
|
|
162
|
+
<div class="console-output">
|
|
163
|
+
<!-- Console output -->
|
|
164
|
+
</div>
|
|
165
|
+
</nr-panel>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Styling
|
|
169
|
+
|
|
170
|
+
The component uses CSS custom properties for styling:
|
|
171
|
+
|
|
172
|
+
```css
|
|
173
|
+
nr-panel {
|
|
174
|
+
--nuraly-panel-background: #ffffff;
|
|
175
|
+
--nuraly-panel-border-color: #e0e0e0;
|
|
176
|
+
--nuraly-panel-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
177
|
+
--nuraly-panel-header-background: #f5f5f5;
|
|
178
|
+
--nuraly-panel-header-text-color: #1a1a1a;
|
|
179
|
+
--nuraly-panel-padding: 1rem;
|
|
180
|
+
--nuraly-panel-header-padding: 0.75rem 1rem;
|
|
181
|
+
--nuraly-panel-font-family: Inter, sans-serif;
|
|
182
|
+
--nuraly-panel-header-font-size: 1.125rem;
|
|
183
|
+
--nuraly-panel-header-font-weight: 600;
|
|
184
|
+
--nuraly-panel-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Use Cases
|
|
189
|
+
|
|
190
|
+
1. **Tool Windows**: Draggable floating windows for tools and utilities
|
|
191
|
+
2. **Settings Panels**: Docked panels for application settings
|
|
192
|
+
3. **Chat Interfaces**: Side panels for team communication
|
|
193
|
+
4. **Property Inspectors**: Panels showing object properties
|
|
194
|
+
5. **Notification Centers**: Panels for displaying notifications
|
|
195
|
+
6. **Command Palettes**: Quick access tool panels
|
|
196
|
+
7. **Documentation Viewers**: Side-by-side documentation panels
|
|
197
|
+
8. **Console/Terminal Output**: Bottom-docked panels for logs
|
|
198
|
+
|
|
199
|
+
## Best Practices
|
|
200
|
+
|
|
201
|
+
1. Use **panel mode** for primary navigation or persistent tools
|
|
202
|
+
2. Use **window mode** for secondary, non-blocking interfaces
|
|
203
|
+
3. Enable **draggable** for windows that users might want to reposition
|
|
204
|
+
4. Enable **resizable** when content might vary in size
|
|
205
|
+
5. Use **minimize** for temporary panel hiding without losing state
|
|
206
|
+
6. Provide clear **titles** for better accessibility
|
|
207
|
+
7. Use appropriate **position** for the panel's purpose (e.g., chat on right, console on bottom)
|
|
208
|
+
8. Consider **collapsible** for panels with secondary information
|
|
209
|
+
|
|
210
|
+
## Browser Support
|
|
211
|
+
|
|
212
|
+
- Chrome/Edge 90+
|
|
213
|
+
- Firefox 88+
|
|
214
|
+
- Safari 14+
|
|
215
|
+
|
|
216
|
+
## License
|
|
217
|
+
|
|
218
|
+
MIT © Nuraly, Laabidi Aymen
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nuralyui/panel",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Panel component for NuralyUI - transformable panel/window with drag and resize",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./index.js"
|
|
10
|
+
},
|
|
11
|
+
"./bundle": {
|
|
12
|
+
"import": "./bundle.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"*.js",
|
|
17
|
+
"*.d.ts",
|
|
18
|
+
"*.js.map",
|
|
19
|
+
"panel.bundled.js",
|
|
20
|
+
"bundle.js"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/Nuralyio/NuralyUI.git",
|
|
28
|
+
"directory": "src/components/panel"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"panel",
|
|
32
|
+
"window",
|
|
33
|
+
"draggable",
|
|
34
|
+
"resizable",
|
|
35
|
+
"web-components",
|
|
36
|
+
"lit"
|
|
37
|
+
],
|
|
38
|
+
"author": "Nuraly, Laabidi Aymen",
|
|
39
|
+
"license": "ISC",
|
|
40
|
+
"nuralyui": {
|
|
41
|
+
"requiredComponents": [
|
|
42
|
+
"nr-icon"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@nuralyui/icon": "^0.0.1",
|
|
47
|
+
"@nuralyui/common": "^0.0.1"
|
|
48
|
+
}
|
|
49
|
+
}
|