@trackunit/react-drawer 1.10.18 → 1.10.20
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/index.cjs.js +50 -0
- package/index.esm.js +50 -0
- package/package.json +5 -5
- package/src/components/Drawer/Drawer.d.ts +50 -0
package/index.cjs.js
CHANGED
|
@@ -190,6 +190,56 @@ const NOOP$1 = () => void 0;
|
|
|
190
190
|
* They start closed but can be temporarily opened, appearing on top of other content until the user chooses a section.
|
|
191
191
|
* To close the drawer, users can either click outside of it or press the Esc key.
|
|
192
192
|
*
|
|
193
|
+
* ### When to use
|
|
194
|
+
* - For secondary content or navigation that doesn't need to be always visible
|
|
195
|
+
* - For filters, settings panels, or detail views that slide in from the side
|
|
196
|
+
* - When you need to preserve context of the underlying page
|
|
197
|
+
*
|
|
198
|
+
* ### When not to use
|
|
199
|
+
* - For critical actions requiring user confirmation (use Modal instead)
|
|
200
|
+
* - For simple tooltips or small contextual information (use Popover)
|
|
201
|
+
*
|
|
202
|
+
* @example Basic drawer with content
|
|
203
|
+
* ```tsx
|
|
204
|
+
* import { Drawer } from "@trackunit/react-drawer";
|
|
205
|
+
* import { Button } from "@trackunit/react-components";
|
|
206
|
+
* import { useState } from "react";
|
|
207
|
+
*
|
|
208
|
+
* const FilterDrawer = () => {
|
|
209
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
210
|
+
*
|
|
211
|
+
* return (
|
|
212
|
+
* <>
|
|
213
|
+
* <Button onClick={() => setIsOpen(true)}>Open Filters</Button>
|
|
214
|
+
* <Drawer
|
|
215
|
+
* open={isOpen}
|
|
216
|
+
* onClose={() => setIsOpen(false)}
|
|
217
|
+
* position="right"
|
|
218
|
+
* >
|
|
219
|
+
* <div className="p-4">
|
|
220
|
+
* <h2>Filter Options</h2>
|
|
221
|
+
* <p>Filter controls go here</p>
|
|
222
|
+
* </div>
|
|
223
|
+
* </Drawer>
|
|
224
|
+
* </>
|
|
225
|
+
* );
|
|
226
|
+
* };
|
|
227
|
+
* ```
|
|
228
|
+
* @example Drawer without overlay for side panels
|
|
229
|
+
* ```tsx
|
|
230
|
+
* import { Drawer } from "@trackunit/react-drawer";
|
|
231
|
+
*
|
|
232
|
+
* const SidePanel = ({ isOpen, content }) => (
|
|
233
|
+
* <Drawer
|
|
234
|
+
* open={isOpen}
|
|
235
|
+
* hasOverlay={false}
|
|
236
|
+
* position="left"
|
|
237
|
+
* keepMountedWhenClosed={true}
|
|
238
|
+
* >
|
|
239
|
+
* {content}
|
|
240
|
+
* </Drawer>
|
|
241
|
+
* );
|
|
242
|
+
* ```
|
|
193
243
|
* @param {DrawerProps} props - The props for the Drawer component
|
|
194
244
|
*/
|
|
195
245
|
const Drawer = ({ open = false, // Default to closed
|
package/index.esm.js
CHANGED
|
@@ -188,6 +188,56 @@ const NOOP$1 = () => void 0;
|
|
|
188
188
|
* They start closed but can be temporarily opened, appearing on top of other content until the user chooses a section.
|
|
189
189
|
* To close the drawer, users can either click outside of it or press the Esc key.
|
|
190
190
|
*
|
|
191
|
+
* ### When to use
|
|
192
|
+
* - For secondary content or navigation that doesn't need to be always visible
|
|
193
|
+
* - For filters, settings panels, or detail views that slide in from the side
|
|
194
|
+
* - When you need to preserve context of the underlying page
|
|
195
|
+
*
|
|
196
|
+
* ### When not to use
|
|
197
|
+
* - For critical actions requiring user confirmation (use Modal instead)
|
|
198
|
+
* - For simple tooltips or small contextual information (use Popover)
|
|
199
|
+
*
|
|
200
|
+
* @example Basic drawer with content
|
|
201
|
+
* ```tsx
|
|
202
|
+
* import { Drawer } from "@trackunit/react-drawer";
|
|
203
|
+
* import { Button } from "@trackunit/react-components";
|
|
204
|
+
* import { useState } from "react";
|
|
205
|
+
*
|
|
206
|
+
* const FilterDrawer = () => {
|
|
207
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
208
|
+
*
|
|
209
|
+
* return (
|
|
210
|
+
* <>
|
|
211
|
+
* <Button onClick={() => setIsOpen(true)}>Open Filters</Button>
|
|
212
|
+
* <Drawer
|
|
213
|
+
* open={isOpen}
|
|
214
|
+
* onClose={() => setIsOpen(false)}
|
|
215
|
+
* position="right"
|
|
216
|
+
* >
|
|
217
|
+
* <div className="p-4">
|
|
218
|
+
* <h2>Filter Options</h2>
|
|
219
|
+
* <p>Filter controls go here</p>
|
|
220
|
+
* </div>
|
|
221
|
+
* </Drawer>
|
|
222
|
+
* </>
|
|
223
|
+
* );
|
|
224
|
+
* };
|
|
225
|
+
* ```
|
|
226
|
+
* @example Drawer without overlay for side panels
|
|
227
|
+
* ```tsx
|
|
228
|
+
* import { Drawer } from "@trackunit/react-drawer";
|
|
229
|
+
*
|
|
230
|
+
* const SidePanel = ({ isOpen, content }) => (
|
|
231
|
+
* <Drawer
|
|
232
|
+
* open={isOpen}
|
|
233
|
+
* hasOverlay={false}
|
|
234
|
+
* position="left"
|
|
235
|
+
* keepMountedWhenClosed={true}
|
|
236
|
+
* >
|
|
237
|
+
* {content}
|
|
238
|
+
* </Drawer>
|
|
239
|
+
* );
|
|
240
|
+
* ```
|
|
191
241
|
* @param {DrawerProps} props - The props for the Drawer component
|
|
192
242
|
*/
|
|
193
243
|
const Drawer = ({ open = false, // Default to closed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-drawer",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.20",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react": "19.0.0",
|
|
11
11
|
"react-swipeable": "^7.0.1",
|
|
12
|
-
"@trackunit/react-components": "1.14.
|
|
13
|
-
"@trackunit/css-class-variance-utilities": "1.10.
|
|
14
|
-
"@trackunit/ui-icons": "1.10.
|
|
15
|
-
"@trackunit/i18n-library-translation": "1.10.
|
|
12
|
+
"@trackunit/react-components": "1.14.20",
|
|
13
|
+
"@trackunit/css-class-variance-utilities": "1.10.16",
|
|
14
|
+
"@trackunit/ui-icons": "1.10.16",
|
|
15
|
+
"@trackunit/i18n-library-translation": "1.10.17"
|
|
16
16
|
},
|
|
17
17
|
"module": "./index.esm.js",
|
|
18
18
|
"main": "./index.cjs.js",
|
|
@@ -60,6 +60,56 @@ export interface DrawerProps extends CommonProps {
|
|
|
60
60
|
* They start closed but can be temporarily opened, appearing on top of other content until the user chooses a section.
|
|
61
61
|
* To close the drawer, users can either click outside of it or press the Esc key.
|
|
62
62
|
*
|
|
63
|
+
* ### When to use
|
|
64
|
+
* - For secondary content or navigation that doesn't need to be always visible
|
|
65
|
+
* - For filters, settings panels, or detail views that slide in from the side
|
|
66
|
+
* - When you need to preserve context of the underlying page
|
|
67
|
+
*
|
|
68
|
+
* ### When not to use
|
|
69
|
+
* - For critical actions requiring user confirmation (use Modal instead)
|
|
70
|
+
* - For simple tooltips or small contextual information (use Popover)
|
|
71
|
+
*
|
|
72
|
+
* @example Basic drawer with content
|
|
73
|
+
* ```tsx
|
|
74
|
+
* import { Drawer } from "@trackunit/react-drawer";
|
|
75
|
+
* import { Button } from "@trackunit/react-components";
|
|
76
|
+
* import { useState } from "react";
|
|
77
|
+
*
|
|
78
|
+
* const FilterDrawer = () => {
|
|
79
|
+
* const [isOpen, setIsOpen] = useState(false);
|
|
80
|
+
*
|
|
81
|
+
* return (
|
|
82
|
+
* <>
|
|
83
|
+
* <Button onClick={() => setIsOpen(true)}>Open Filters</Button>
|
|
84
|
+
* <Drawer
|
|
85
|
+
* open={isOpen}
|
|
86
|
+
* onClose={() => setIsOpen(false)}
|
|
87
|
+
* position="right"
|
|
88
|
+
* >
|
|
89
|
+
* <div className="p-4">
|
|
90
|
+
* <h2>Filter Options</h2>
|
|
91
|
+
* <p>Filter controls go here</p>
|
|
92
|
+
* </div>
|
|
93
|
+
* </Drawer>
|
|
94
|
+
* </>
|
|
95
|
+
* );
|
|
96
|
+
* };
|
|
97
|
+
* ```
|
|
98
|
+
* @example Drawer without overlay for side panels
|
|
99
|
+
* ```tsx
|
|
100
|
+
* import { Drawer } from "@trackunit/react-drawer";
|
|
101
|
+
*
|
|
102
|
+
* const SidePanel = ({ isOpen, content }) => (
|
|
103
|
+
* <Drawer
|
|
104
|
+
* open={isOpen}
|
|
105
|
+
* hasOverlay={false}
|
|
106
|
+
* position="left"
|
|
107
|
+
* keepMountedWhenClosed={true}
|
|
108
|
+
* >
|
|
109
|
+
* {content}
|
|
110
|
+
* </Drawer>
|
|
111
|
+
* );
|
|
112
|
+
* ```
|
|
63
113
|
* @param {DrawerProps} props - The props for the Drawer component
|
|
64
114
|
*/
|
|
65
115
|
export declare const Drawer: {
|