@manhphi1309/dialog 0.3.3 → 0.3.5
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/index.cjs +7 -9
- package/dist/index.d.cts +4 -6
- package/dist/index.d.mts +4 -6
- package/dist/index.mjs +7 -9
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -281,7 +281,7 @@ const ResponsiveDialogContext = react.createContext({ snap: true });
|
|
|
281
281
|
* </ResponsiveDialogContent>
|
|
282
282
|
* </ResponsiveDialog>
|
|
283
283
|
*/
|
|
284
|
-
function ResponsiveDialog({ children, snapPoints, activeSnapPoint, setActiveSnapPoint,
|
|
284
|
+
function ResponsiveDialog({ children, snapPoints, activeSnapPoint, setActiveSnapPoint, dismissible, snap = true, ...props }) {
|
|
285
285
|
const isMobile = (0, _manhphi1309_hooks.useIsMobile)();
|
|
286
286
|
const [internalOpen, setInternalOpen] = react.useState(props.defaultOpen ?? false);
|
|
287
287
|
const isControlled = props.open !== void 0;
|
|
@@ -291,18 +291,16 @@ function ResponsiveDialog({ children, snapPoints, activeSnapPoint, setActiveSnap
|
|
|
291
291
|
if (!isControlled) setInternalOpen(newOpen);
|
|
292
292
|
onOpenChange?.(newOpen);
|
|
293
293
|
}, [isControlled, onOpenChange]);
|
|
294
|
-
const defaultSnapPoints = react.useMemo(() => [1], []);
|
|
295
294
|
if (isMobile) {
|
|
296
295
|
const drawerProps = {
|
|
297
296
|
...props,
|
|
298
297
|
open,
|
|
299
298
|
onOpenChange: handleOpenChange,
|
|
300
|
-
snapPoints: snap
|
|
299
|
+
snapPoints: snap && snapPoints,
|
|
301
300
|
activeSnapPoint,
|
|
302
301
|
setActiveSnapPoint,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
dismissible
|
|
302
|
+
dismissible,
|
|
303
|
+
fadeFromIndex: 0
|
|
306
304
|
};
|
|
307
305
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ResponsiveDialogContext.Provider, {
|
|
308
306
|
value: { snap },
|
|
@@ -413,10 +411,10 @@ function ResponsiveDialogContent({ className, children, showCloseButton = true,
|
|
|
413
411
|
* Typically contains `ResponsiveDialogTitle` and optionally
|
|
414
412
|
* `ResponsiveDialogDescription`.
|
|
415
413
|
*/
|
|
416
|
-
function ResponsiveDialogHeader({ className,
|
|
414
|
+
function ResponsiveDialogHeader({ className, leftAction, rightAction, children, ...props }) {
|
|
417
415
|
if ((0, _manhphi1309_hooks.useIsMobile)()) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_manhphi1309_drawer.DrawerHeader, {
|
|
418
|
-
|
|
419
|
-
|
|
416
|
+
leftAction,
|
|
417
|
+
rightAction,
|
|
420
418
|
className,
|
|
421
419
|
...props,
|
|
422
420
|
children
|
package/dist/index.d.cts
CHANGED
|
@@ -214,8 +214,6 @@ declare function ResponsiveDialog({
|
|
|
214
214
|
snapPoints,
|
|
215
215
|
activeSnapPoint,
|
|
216
216
|
setActiveSnapPoint,
|
|
217
|
-
fadeFromIndex,
|
|
218
|
-
shouldScaleBackground,
|
|
219
217
|
dismissible,
|
|
220
218
|
snap,
|
|
221
219
|
...props
|
|
@@ -295,13 +293,13 @@ declare function ResponsiveDialogContent({
|
|
|
295
293
|
*/
|
|
296
294
|
declare function ResponsiveDialogHeader({
|
|
297
295
|
className,
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
leftAction,
|
|
297
|
+
rightAction,
|
|
300
298
|
children,
|
|
301
299
|
...props
|
|
302
300
|
}: React.ComponentProps<"div"> & {
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
leftAction?: React.ReactNode;
|
|
302
|
+
rightAction?: React.ReactNode;
|
|
305
303
|
}): React.JSX.Element;
|
|
306
304
|
/**
|
|
307
305
|
* Layout wrapper for the **bottom action area** of the responsive
|
package/dist/index.d.mts
CHANGED
|
@@ -214,8 +214,6 @@ declare function ResponsiveDialog({
|
|
|
214
214
|
snapPoints,
|
|
215
215
|
activeSnapPoint,
|
|
216
216
|
setActiveSnapPoint,
|
|
217
|
-
fadeFromIndex,
|
|
218
|
-
shouldScaleBackground,
|
|
219
217
|
dismissible,
|
|
220
218
|
snap,
|
|
221
219
|
...props
|
|
@@ -295,13 +293,13 @@ declare function ResponsiveDialogContent({
|
|
|
295
293
|
*/
|
|
296
294
|
declare function ResponsiveDialogHeader({
|
|
297
295
|
className,
|
|
298
|
-
|
|
299
|
-
|
|
296
|
+
leftAction,
|
|
297
|
+
rightAction,
|
|
300
298
|
children,
|
|
301
299
|
...props
|
|
302
300
|
}: React.ComponentProps<"div"> & {
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
leftAction?: React.ReactNode;
|
|
302
|
+
rightAction?: React.ReactNode;
|
|
305
303
|
}): React.JSX.Element;
|
|
306
304
|
/**
|
|
307
305
|
* Layout wrapper for the **bottom action area** of the responsive
|
package/dist/index.mjs
CHANGED
|
@@ -257,7 +257,7 @@ const ResponsiveDialogContext = React.createContext({ snap: true });
|
|
|
257
257
|
* </ResponsiveDialogContent>
|
|
258
258
|
* </ResponsiveDialog>
|
|
259
259
|
*/
|
|
260
|
-
function ResponsiveDialog({ children, snapPoints, activeSnapPoint, setActiveSnapPoint,
|
|
260
|
+
function ResponsiveDialog({ children, snapPoints, activeSnapPoint, setActiveSnapPoint, dismissible, snap = true, ...props }) {
|
|
261
261
|
const isMobile = useIsMobile();
|
|
262
262
|
const [internalOpen, setInternalOpen] = React.useState(props.defaultOpen ?? false);
|
|
263
263
|
const isControlled = props.open !== void 0;
|
|
@@ -267,18 +267,16 @@ function ResponsiveDialog({ children, snapPoints, activeSnapPoint, setActiveSnap
|
|
|
267
267
|
if (!isControlled) setInternalOpen(newOpen);
|
|
268
268
|
onOpenChange?.(newOpen);
|
|
269
269
|
}, [isControlled, onOpenChange]);
|
|
270
|
-
const defaultSnapPoints = React.useMemo(() => [1], []);
|
|
271
270
|
if (isMobile) {
|
|
272
271
|
const drawerProps = {
|
|
273
272
|
...props,
|
|
274
273
|
open,
|
|
275
274
|
onOpenChange: handleOpenChange,
|
|
276
|
-
snapPoints: snap
|
|
275
|
+
snapPoints: snap && snapPoints,
|
|
277
276
|
activeSnapPoint,
|
|
278
277
|
setActiveSnapPoint,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
dismissible
|
|
278
|
+
dismissible,
|
|
279
|
+
fadeFromIndex: 0
|
|
282
280
|
};
|
|
283
281
|
return /* @__PURE__ */ jsx(ResponsiveDialogContext.Provider, {
|
|
284
282
|
value: { snap },
|
|
@@ -389,10 +387,10 @@ function ResponsiveDialogContent({ className, children, showCloseButton = true,
|
|
|
389
387
|
* Typically contains `ResponsiveDialogTitle` and optionally
|
|
390
388
|
* `ResponsiveDialogDescription`.
|
|
391
389
|
*/
|
|
392
|
-
function ResponsiveDialogHeader({ className,
|
|
390
|
+
function ResponsiveDialogHeader({ className, leftAction, rightAction, children, ...props }) {
|
|
393
391
|
if (useIsMobile()) return /* @__PURE__ */ jsx(DrawerHeader, {
|
|
394
|
-
|
|
395
|
-
|
|
392
|
+
leftAction,
|
|
393
|
+
rightAction,
|
|
396
394
|
className,
|
|
397
395
|
...props,
|
|
398
396
|
children
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manhphi1309/dialog",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"react-dom": "^19.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@manhphi1309/button": "
|
|
32
|
-
"@manhphi1309/drawer": "
|
|
33
|
-
"@manhphi1309/hooks": "
|
|
34
|
-
"@manhphi1309/utils": "
|
|
31
|
+
"@manhphi1309/button": "*",
|
|
32
|
+
"@manhphi1309/drawer": "*",
|
|
33
|
+
"@manhphi1309/hooks": "*",
|
|
34
|
+
"@manhphi1309/utils": "*",
|
|
35
35
|
"class-variance-authority": "^0.7.1"
|
|
36
36
|
}
|
|
37
37
|
}
|