Skip to content

Commit

Permalink
feat: 🎸 update headlessui v2
Browse files Browse the repository at this point in the history
Signed-off-by: kodai3 <k3dai.su3@gmail.com>
  • Loading branch information
kodai3 committed Sep 16, 2024
1 parent 62fd636 commit 38c413c
Show file tree
Hide file tree
Showing 6 changed files with 210 additions and 44 deletions.
198 changes: 182 additions & 16 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@chromatic-com/storybook": "^1.4.0",
"@headlessui/react": "^1.7.10",
"@headlessui/react": "^2.1.8",
"@markuplint/jsx-parser": "^4.4.0",
"@markuplint/react-spec": "^4.2.0",
"@playwright/experimental-ct-react": "^1.38.1",
Expand Down Expand Up @@ -125,12 +125,12 @@
"vitest": "^0.34.3"
},
"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",
"clsx": ">1.2.0",
"react": "^17 || ^18",
"react-dom": "^17 || ^18"
"react": "^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, DialogTitle, 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 Down Expand Up @@ -194,7 +194,7 @@ export const ActionHalfModal: FC<Props> = ({
>
{hero !== undefined ? <div className={styles.hero}>{hero}</div> : null}
{header !== undefined ? (
<Dialog.Title
<DialogTitle
tabIndex={-1}
ref={initialFocusRef}
className={clsx(
Expand All @@ -204,7 +204,7 @@ export const ActionHalfModal: FC<Props> = ({
)}
>
{header}
</Dialog.Title>
</DialogTitle>
) : null}
<div
className={clsx(styles.body, {
Expand Down Expand Up @@ -244,7 +244,7 @@ export const ActionHalfModal: FC<Props> = ({
</div>
</div>
</div>
</Transition.Child>
</TransitionChild>
</Dialog>
</Transition>
);
Expand Down
8 changes: 4 additions & 4 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, 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,7 +162,7 @@ export const ActionModal: FC<Props> = ({
initialFocus={initialFocusRef}
{...props}
>
<Dialog.Overlay className={clsx(styles.overlay, styles[opacityClassName])} />
<div className={clsx(styles.overlay, styles[opacityClassName])} />
<div
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
Loading

0 comments on commit 38c413c

Please sign in to comment.