-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/add draggable modal #3983
Merged
Merged
Feat/add draggable modal #3983
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
03b0fc5
feat(hooks): add use-draggable hook
wzc520pyfm a19945f
feat(components): [modal] export use-draggable
wzc520pyfm 24aa1ce
docs(components): [modal] add draggable modal
wzc520pyfm 34e2f53
feat(components): [modal] add ref prop for modal-header
wzc520pyfm 56d6cf3
chore(components): [modal] add draggable modal for storybook
wzc520pyfm bf9ca51
chore: add changeset for draggable modal
wzc520pyfm 9bb1a89
docs(hooks): [use-draggable] fix typo
wzc520pyfm 2ba3742
chore: upper changeset
wzc520pyfm 0e9caa6
chore(components): [modal] add overflow draggable modal to sb
wzc520pyfm a64ec22
test(components): [modal] add draggable modal tests
wzc520pyfm f9463c5
build: update pnpm-lock
wzc520pyfm ec5789d
Merge branch 'main' into pr/2818
wingkwong b6198b6
chore(changeset): include issue number
wingkwong c9b6ac6
Merge branch 'nextui-org:main' into feat/add-draggable-modal
wzc520pyfm e0a8dea
feat(hooks): [use-draggable] set user-select to none when during the …
wzc520pyfm 7c27351
docs(components): [modal] update code demo title
wzc520pyfm 90699f2
docs(components): [modal] condense description for draggable overflow
wzc520pyfm 6680886
feat(hooks): [use-draggable] change version to 0.1.0
wzc520pyfm a9cb28b
refactor(hooks): [use-draggable] use use-move implement use-draggable
wzc520pyfm a9e9cac
feat(hooks): [use-draggable] remove repeated user-select
wzc520pyfm a0e2b98
test(components): [modal] update test case to use-draggable base use-…
wzc520pyfm f0bddfa
docs(components): [modal] update draggable examples
wzc520pyfm 663aec4
fix(hooks): [use-draggable] fix mobile device touchmove event conflict
wzc520pyfm b46fd73
refactor(hooks): [use-draggable] remove drag ref prop
wzc520pyfm 142b3ff
refactor(hooks): [use-draggable] draggable2is-disabled overflow2can-o…
wzc520pyfm 28b114b
test(components): [modal] add draggble disable test
wzc520pyfm b85e591
chore(hooks): [use-draggable] add commant for body touchmove
wzc520pyfm cd96af7
Update packages/hooks/use-draggable/src/index.ts
wzc520pyfm 2aff343
fix(hooks): [use-draggable] import use-callback
wzc520pyfm 678d3e7
test(components): [modal] add mobile-sized test for draggable
wzc520pyfm 50ee586
chore(hooks): [use-draggable] add use-callback for func
wzc520pyfm c45f9be
Merge branch 'canary' into feat/add-draggable-modal
wzc520pyfm 0c282dd
chore(hooks): [use-draggable] update version to 2.0.0
wzc520pyfm 09b5b8d
chore: fix typo
wzc520pyfm f3f4eab
Update .changeset/soft-apricots-sleep.md
jrgarciadev f6c51f1
Merge branch 'canary' of github.com:nextui-org/nextui into feat/add-d…
jrgarciadev d8795d2
fix: pnpm lock
jrgarciadev 5721340
fix: build
jrgarciadev bf4affb
chore: add updated moadl
jrgarciadev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider using minor version bumps instead of patches.
According to semantic versioning guidelines, adding new functionality (like the draggable modal feature) typically warrants a minor version bump rather than a patch. Patch versions are reserved for backward-compatible bug fixes.
Apply this diff to update the version types:
📝 Committable suggestion