Skip to content
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

Bump @headlessui/react to v2 #389

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Console/InstallsInertiaStacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ protected function installInertiaReactStack()
// NPM Packages...
$this->updateNodePackages(function ($packages) {
return [
'@headlessui/react' => '^1.4.2',
'@headlessui/react' => '^2.0.0',
'@inertiajs/react' => '^1.0.0',
'@tailwindcss/forms' => '^0.5.3',
'@vitejs/plugin-react' => '^4.2.0',
Expand Down
3 changes: 1 addition & 2 deletions stubs/inertia-react-ts/resources/js/Components/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, createContext, useContext, Fragment, PropsWithChildren, Dispatch, SetStateAction } from 'react';
import { useState, createContext, useContext, PropsWithChildren, Dispatch, SetStateAction } from 'react';
import { Link, InertiaLinkProps } from '@inertiajs/react';
import { Transition } from '@headlessui/react';

Expand Down Expand Up @@ -58,7 +58,6 @@ const Content = ({ align = 'right', width = '48', contentClasses = 'py-1 bg-whit
return (
<>
<Transition
as={Fragment}
show={open}
enter="transition ease-out duration-200"
enterFrom="opacity-0 scale-95"
Expand Down
20 changes: 9 additions & 11 deletions stubs/inertia-react-ts/resources/js/Components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment, PropsWithChildren } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import { PropsWithChildren } from 'react';
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react';

export default function Modal({
children,
Expand Down Expand Up @@ -28,15 +28,14 @@ export default function Modal({
}[maxWidth];

return (
<Transition show={show} as={Fragment} leave="duration-200">
<Transition show={show} leave="duration-200">
<Dialog
as="div"
id="modal"
className="fixed inset-0 flex overflow-y-auto px-4 py-6 sm:px-0 items-center z-50 transform transition-all"
onClose={close}
>
<Transition.Child
as={Fragment}
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
Expand All @@ -45,23 +44,22 @@ export default function Modal({
leaveTo="opacity-0"
>
<div className="absolute inset-0 bg-gray-500/75 dark:bg-gray-900/75" />
</Transition.Child>
</TransitionChild>

<Transition.Child
as={Fragment}
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel
<DialogPanel
className={`mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto ${maxWidthClass}`}
>
{children}
</Dialog.Panel>
</Transition.Child>
</DialogPanel>
</TransitionChild>
</Dialog>
</Transition>
);
Expand Down
3 changes: 1 addition & 2 deletions stubs/inertia-react/resources/js/Components/Dropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, createContext, useContext, Fragment } from 'react';
import { useState, createContext, useContext } from 'react';
import { Link } from '@inertiajs/react';
import { Transition } from '@headlessui/react';

Expand Down Expand Up @@ -50,7 +50,6 @@ const Content = ({ align = 'right', width = '48', contentClasses = 'py-1 bg-whit
return (
<>
<Transition
as={Fragment}
show={open}
enter="transition ease-out duration-200"
enterFrom="opacity-0 scale-95"
Expand Down
19 changes: 8 additions & 11 deletions stubs/inertia-react/resources/js/Components/Modal.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Fragment } from 'react';
import { Dialog, Transition } from '@headlessui/react';
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react';

export default function Modal({ children, show = false, maxWidth = '2xl', closeable = true, onClose = () => {} }) {
const close = () => {
Expand All @@ -17,15 +16,14 @@ export default function Modal({ children, show = false, maxWidth = '2xl', closea
}[maxWidth];

return (
<Transition show={show} as={Fragment} leave="duration-200">
<Transition show={show} leave="duration-200">
<Dialog
as="div"
id="modal"
className="fixed inset-0 flex overflow-y-auto px-4 py-6 sm:px-0 items-center z-50 transform transition-all"
onClose={close}
>
<Transition.Child
as={Fragment}
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
Expand All @@ -34,23 +32,22 @@ export default function Modal({ children, show = false, maxWidth = '2xl', closea
leaveTo="opacity-0"
>
<div className="absolute inset-0 bg-gray-500/75 dark:bg-gray-900/75" />
</Transition.Child>
</TransitionChild>

<Transition.Child
as={Fragment}
<TransitionChild
enter="ease-out duration-300"
enterFrom="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
enterTo="opacity-100 translate-y-0 sm:scale-100"
leave="ease-in duration-200"
leaveFrom="opacity-100 translate-y-0 sm:scale-100"
leaveTo="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
<Dialog.Panel
<DialogPanel
className={`mb-6 bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full sm:mx-auto ${maxWidthClass}`}
>
{children}
</Dialog.Panel>
</Transition.Child>
</DialogPanel>
</TransitionChild>
</Dialog>
</Transition>
);
Expand Down