Skip to content

Commit

Permalink
Merge pull request #134 from ubie-oss/upgrade-headlessui
Browse files Browse the repository at this point in the history
Upgrade headless-ui to v2
  • Loading branch information
takanorip authored Sep 20, 2024
2 parents 3a4d584 + e496f4f commit 6516d11
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 48 deletions.
189 changes: 174 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"devDependencies": {
"@axe-core/playwright": "^4.10.0",
"@chromatic-com/storybook": "^2.0.2",
"@headlessui/react": "^1.7.10",
"@headlessui/react": "^2.1.8",
"@markuplint/jsx-parser": "^4.7.6",
"@markuplint/react-spec": "^4.5.6",
"@playwright/experimental-ct-react": "^1.47.1",
Expand Down Expand Up @@ -107,11 +107,11 @@
"vitest": "^2.1.1"
},
"peerDependencies": {
"@headlessui/react": ">1.7.0 <2.0.0",
"@headlessui/react": "^2.0.0",
"@ubie/design-tokens": ">=0.2.0",
"@ubie/ubie-icons": ">=0.5.0 <0.6.2 || >=0.8.0",
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
"react-dom": "^18"
},
"author": "Ubie, Inc.",
"license": "Apache-2.0",
Expand Down
16 changes: 8 additions & 8 deletions src/components/ActionHalfModal/ActionHalfModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { Dialog, Transition } from '@headlessui/react';
import { Dialog, DialogPanel, Transition, TransitionChild } from '@headlessui/react';
import { clsx } from 'clsx';
import { type FC, Fragment, type ReactNode, useCallback, useRef } from 'react';
import styles from './ActionHalfModal.module.css';
Expand Down Expand Up @@ -155,7 +155,7 @@ export const ActionHalfModal: FC<Props> = ({
initialFocus={initialFocusRef}
{...props}
>
<Transition.Child
<TransitionChild
as={Fragment}
enter={styles.overlayEnter}
enterFrom={styles.overlayEnterFrom}
Expand All @@ -164,9 +164,9 @@ export const ActionHalfModal: FC<Props> = ({
leaveFrom={styles.overlayLeaveFrom}
leaveTo={styles.overlayLeaveTo}
>
<Dialog.Overlay className={clsx(styles.overlay, styles[opacityClassName])} />
</Transition.Child>
<Transition.Child
<div className={clsx(styles.overlay, styles[opacityClassName])} />
</TransitionChild>
<TransitionChild
as={Fragment}
enter={styles.panelEnter}
enterFrom={styles.panelEnterFrom}
Expand All @@ -175,7 +175,7 @@ export const ActionHalfModal: FC<Props> = ({
leaveFrom={styles.panelLeaveFrom}
leaveTo={styles.panelLeaveTo}
>
<div
<DialogPanel
className={clsx(styles.dialog, {
[styles.fullscreen]: fullscreen,
})}
Expand Down Expand Up @@ -243,8 +243,8 @@ export const ActionHalfModal: FC<Props> = ({
</div>
</div>
</div>
</div>
</Transition.Child>
</DialogPanel>
</TransitionChild>
</Dialog>
</Transition>
);
Expand Down
12 changes: 6 additions & 6 deletions src/components/ActionModal/ActionModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { Dialog, Transition } from '@headlessui/react';
import { Dialog, DialogPanel, DialogTitle, Transition } from '@headlessui/react';
import clsx from 'clsx';
import { type FC, Fragment, type ReactNode, useCallback, useRef } from 'react';
import styles from './ActionModal.module.css';
Expand Down Expand Up @@ -162,8 +162,8 @@ export const ActionModal: FC<Props> = ({
initialFocus={initialFocusRef}
{...props}
>
<Dialog.Overlay className={clsx(styles.overlay, styles[opacityClassName])} />
<div
<div className={clsx(styles.overlay, styles[opacityClassName])} />
<DialogPanel
className={clsx(styles.dialog, {
[styles.fixedHeight]: fixedHeight,
})}
Expand All @@ -182,7 +182,7 @@ export const ActionModal: FC<Props> = ({
>
{hero !== undefined ? <div className={styles.hero}>{hero}</div> : null}
{header !== undefined ? (
<Dialog.Title
<DialogTitle
tabIndex={-1}
ref={initialFocusRef}
className={clsx(
Expand All @@ -192,7 +192,7 @@ export const ActionModal: FC<Props> = ({
)}
>
{header}
</Dialog.Title>
</DialogTitle>
) : null}
<div
className={clsx(styles.body, {
Expand Down Expand Up @@ -226,7 +226,7 @@ export const ActionModal: FC<Props> = ({
</div>
</div>
</div>
</div>
</DialogPanel>
</Dialog>
</Transition>
);
Expand Down
Loading

0 comments on commit 6516d11

Please sign in to comment.