-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(hooks): add use-draggable hook * feat(components): [modal] export use-draggable * docs(components): [modal] add draggable modal * feat(components): [modal] add ref prop for modal-header * chore(components): [modal] add draggable modal for storybook * chore: add changeset for draggable modal * docs(hooks): [use-draggable] fix typo * chore: upper changeset * chore(components): [modal] add overflow draggable modal to sb * test(components): [modal] add draggable modal tests * build: update pnpm-lock * chore(changeset): include issue number * feat(hooks): [use-draggable] set user-select to none when during the dragging * docs(components): [modal] update code demo title * docs(components): [modal] condense description for draggable overflow * feat(hooks): [use-draggable] change version to 0.1.0 * refactor(hooks): [use-draggable] use use-move implement use-draggable * feat(hooks): [use-draggable] remove repeated user-select * test(components): [modal] update test case to use-draggable base use-move * docs(components): [modal] update draggable examples * fix(hooks): [use-draggable] fix mobile device touchmove event conflict * refactor(hooks): [use-draggable] remove drag ref prop * refactor(hooks): [use-draggable] draggable2is-disabled overflow2can-overflow * test(components): [modal] add draggble disable test * chore(hooks): [use-draggable] add commant for body touchmove * Update packages/hooks/use-draggable/src/index.ts Co-authored-by: Ryo Matsukawa <76232929+ryo-manba@users.noreply.github.com> * fix(hooks): [use-draggable] import use-callback * test(components): [modal] add mobile-sized test for draggable * chore(hooks): [use-draggable] add use-callback for func * chore(hooks): [use-draggable] update version to 2.0.0 * chore: fix typo * Update .changeset/soft-apricots-sleep.md * fix: pnpm lock * fix: build * chore: add updated moadl --------- Co-authored-by: wzc520pyfm <1528857653@qq.com> Co-authored-by: աɨռɢӄաօռɢ <wingkwong.code@gmail.com> Co-authored-by: Ryo Matsukawa <76232929+ryo-manba@users.noreply.github.com>
- Loading branch information
1 parent
d90ad05
commit 2d6ae74
Showing
18 changed files
with
532 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@nextui-org/modal": patch | ||
"@nextui-org/use-draggable": patch | ||
--- | ||
|
||
Add draggable modal (#2647) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, useDraggable} from "@nextui-org/react"; | ||
export default function App() { | ||
const {isOpen, onOpen, onOpenChange} = useDisclosure(); | ||
const targetRef = React.useRef(null); | ||
const {moveProps} = useDraggable({targetRef, canOverflow: true}); | ||
return ( | ||
<> | ||
<Button onPress={onOpen}>Open Modal</Button> | ||
<Modal ref={targetRef} isOpen={isOpen} onOpenChange={onOpenChange}> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader {...moveProps} className="flex flex-col gap-1">Modal Title</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
Nullam pulvinar risus non risus hendrerit venenatis. | ||
Pellentesque sit amet hendrerit risus, sed porttitor quam. | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="danger" variant="light" onPress={onClose}> | ||
Close | ||
</Button> | ||
<Button color="primary" onPress={onClose}> | ||
Action | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
}`; | ||
|
||
const react = { | ||
"/App.jsx": App, | ||
}; | ||
|
||
export default { | ||
...react, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
const App = `import {Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Button, useDisclosure, useDraggable} from "@nextui-org/react"; | ||
export default function App() { | ||
const {isOpen, onOpen, onOpenChange} = useDisclosure(); | ||
const targetRef = React.useRef(null); | ||
const {moveProps} = useDraggable({ targetRef }); | ||
return ( | ||
<> | ||
<Button onPress={onOpen}>Open Modal</Button> | ||
<Modal ref={targetRef} isOpen={isOpen} onOpenChange={onOpenChange}> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader {...moveProps} className="flex flex-col gap-1">Modal Title</ModalHeader> | ||
<ModalBody> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
Nullam pulvinar risus non risus hendrerit venenatis. | ||
Pellentesque sit amet hendrerit risus, sed porttitor quam. | ||
</p> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button color="danger" variant="light" onPress={onClose}> | ||
Close | ||
</Button> | ||
<Button color="primary" onPress={onClose}> | ||
Action | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
); | ||
}`; | ||
|
||
const react = { | ||
"/App.jsx": App, | ||
}; | ||
|
||
export default { | ||
...react, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.