From 64da4311b8fe62a952ead100b8a91307bb4a4c82 Mon Sep 17 00:00:00 2001 From: Qs-F Date: Wed, 22 Oct 2025 20:53:08 +0900 Subject: [PATCH 1/4] feat: add PropsWithHTMLAttributes type --- packages/smarthr-ui/src/types/ComponentTypes.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/smarthr-ui/src/types/ComponentTypes.ts b/packages/smarthr-ui/src/types/ComponentTypes.ts index 11f8eaaf71..2d1d0977d5 100644 --- a/packages/smarthr-ui/src/types/ComponentTypes.ts +++ b/packages/smarthr-ui/src/types/ComponentTypes.ts @@ -1,5 +1,10 @@ -import type { ComponentPropsWithRef, ElementType } from 'react' +import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType, FC } from 'react' export type ElementRef = ComponentPropsWithRef['ref'] export type ElementRefProps = { ref?: ElementRef } + +export type PropsWithHTMLAttributes< + Props extends Parameters[0], + E extends ElementType, +> = Props & Omit, keyof Props> From 8a505c9ec3abb1a4ded7ac819fdfabb89f37e138 Mon Sep 17 00:00:00 2001 From: Qs-F Date: Wed, 22 Oct 2025 20:53:41 +0900 Subject: [PATCH 2/4] =?UTF-8?q?fix(ModelessDialog):=20title=20props?= =?UTF-8?q?=E3=81=8CReactNode=E3=82=92=E5=8F=97=E3=81=91=E5=8F=96=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dialog/ModelessDialog/ModelessDialog.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx b/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx index ea27055a0f..0ede12489a 100644 --- a/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx +++ b/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx @@ -1,7 +1,7 @@ 'use client' import { - type ComponentProps, + type ComponentPropsWithoutRef, type FC, type KeyboardEvent, type MouseEvent, @@ -22,7 +22,7 @@ import { type VariantProps, tv } from 'tailwind-variants' import { useHandleEscape } from '../../../hooks/useHandleEscape' import { useIntl } from '../../../intl' import { dialogSize } from '../../../themes/tailwind' -import { Base, type BaseElementProps } from '../../Base' +import { Base } from '../../Base' import { Button } from '../../Button' import { Heading } from '../../Heading' import { FaGripIcon, FaXmarkIcon } from '../../Icon' @@ -31,6 +31,7 @@ import { DialogOverlap } from '../DialogOverlap' import { useDialogPortal } from '../useDialogPortal' import type { DecoratorsType } from '../../../hooks/useDecorators' +import type { PropsWithHTMLAttributes } from '../../../types/ComponentTypes' import type { DialogSize } from '../types' type Props = PropsWithChildren<{ @@ -135,9 +136,12 @@ const classNameGenerator = tv({ }, }) -export const ModelessDialog: FC< - Props & BaseElementProps & VariantProps -> = ({ +type ComponentProps = PropsWithHTMLAttributes< + Props & VariantProps, + 'div' +> + +export const ModelessDialog: FC = ({ title, children, contentBgColor, @@ -193,7 +197,7 @@ export const ModelessDialog: FC< y: 0, }) const [draggableBounds, setDraggableBounds] = - useState['bounds']>() + useState['bounds']>() const decoratorDefaultTexts = useMemo( () => ({ From 8a4a6a1046b08d0a6f69d052db7a460fd1ac26bb Mon Sep 17 00:00:00 2001 From: AtsushiM Date: Wed, 13 May 2026 12:35:44 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor:=20PropsWithHTMLAttributes?= =?UTF-8?q?=E3=81=8B=E3=82=89=E4=B8=8D=E8=A6=81=E3=81=AAParameters[0]?= =?UTF-8?q?=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parameters[0]はextendsの制約として機能していなかったため削除。 単にPropsとすることで意図を明確化。 Co-Authored-By: Claude Sonnet 4.5 --- packages/smarthr-ui/src/types/ComponentTypes.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/smarthr-ui/src/types/ComponentTypes.ts b/packages/smarthr-ui/src/types/ComponentTypes.ts index 2d1d0977d5..e16ba8ddcd 100644 --- a/packages/smarthr-ui/src/types/ComponentTypes.ts +++ b/packages/smarthr-ui/src/types/ComponentTypes.ts @@ -1,10 +1,8 @@ -import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType, FC } from 'react' +import type { ComponentPropsWithRef, ComponentPropsWithoutRef, ElementType } from 'react' export type ElementRef = ComponentPropsWithRef['ref'] export type ElementRefProps = { ref?: ElementRef } -export type PropsWithHTMLAttributes< - Props extends Parameters[0], - E extends ElementType, -> = Props & Omit, keyof Props> +export type PropsWithHTMLAttributes = Props & + Omit, keyof Props> From a45945c38f92f52c0857e2b9c41fc85280843bef Mon Sep 17 00:00:00 2001 From: AtsushiM Date: Wed, 13 May 2026 12:48:26 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor(ModelessDialog):=20=E5=9E=8B?= =?UTF-8?q?=E5=AE=9A=E7=BE=A9=E3=82=92=E7=B0=A1=E6=BD=94=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 複数のOmitを一つにまとめ、不要な中間型Propsを削除。 型の意味は変わらず、コードの可読性が向上。 Co-Authored-By: Claude Sonnet 4.5 --- .../Dialog/ModelessDialog/ModelessDialog.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx b/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx index 5e01c5fbbd..5d7a24c7ac 100644 --- a/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx +++ b/packages/smarthr-ui/src/components/Dialog/ModelessDialog/ModelessDialog.tsx @@ -89,10 +89,15 @@ type AbstractProps = PropsWithChildren<{ */ portalParent?: HTMLElement | RefObject }> -type Props = AbstractProps & - Omit & - Omit & - Omit, keyof AbstractProps> + +type ComponentProps = PropsWithHTMLAttributes< + AbstractProps & + Omit< + DialogBodyProps & BaseElementProps & VariantProps, + keyof AbstractProps + >, + 'div' +> const classNameGenerator = tv({ slots: { @@ -134,11 +139,6 @@ const classNameGenerator = tv({ }, }) -type ComponentProps = PropsWithHTMLAttributes< - Props & VariantProps, - 'div' -> - export const ModelessDialog: FC = ({ heading, children,