Skip to content

Commit

Permalink
fix: ModelessDialog に渡した className が当たる場所を変更 (#4978)
Browse files Browse the repository at this point in the history
  • Loading branch information
uknmr authored Oct 7, 2024
1 parent c5e6b98 commit cdc7e4e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/smarthr-ui/src/components/Dialog/ModelessDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const CLOSE_BUTTON_ICON_ALT = '閉じる'

const modelessDialog = tv({
slots: {
overlap: 'shr-inset-[unset]',
wrapper: 'smarthr-ui-ModelessDialog shr-fixed shr-flex shr-flex-col',
headerEl:
'smarthr-ui-ModelessDialog-header shr-border-b-shorthand shr-relative shr-flex shr-cursor-move shr-items-center shr-rounded-tl-l shr-rounded-tr-l shr-pe-1 shr-ps-1.5 hover:shr-bg-white-darken',
Expand Down Expand Up @@ -143,17 +144,19 @@ export const ModelessDialog: FC<Props & BaseElementProps & VariantProps<typeof m
const { spacing } = useTheme()

const {
overlapStyle,
wrapperStyle,
headerStyle,
titleStyle,
dialogHandlerStyle,
closeButtonLayoutStyle,
footerStyle,
} = useMemo(() => {
const { wrapper, headerEl, title, dialogHandler, closeButtonLayout, footerEl } =
const { overlap, wrapper, headerEl, title, dialogHandler, closeButtonLayout, footerEl } =
modelessDialog()
return {
wrapperStyle: wrapper({ resizable, className }),
overlapStyle: overlap({ className }),
wrapperStyle: wrapper({ resizable }),
headerStyle: headerEl(),
titleStyle: title(),
dialogHandlerStyle: dialogHandler(),
Expand Down Expand Up @@ -314,7 +317,7 @@ export const ModelessDialog: FC<Props & BaseElementProps & VariantProps<typeof m
)

return createPortal(
<DialogOverlap isOpen={isOpen} className="shr-inset-[unset]">
<DialogOverlap isOpen={isOpen} className={overlapStyle}>
<Draggable
handle=".smarthr-ui-ModelessDialog-handle"
onStart={(_, data) => setPosition({ x: data.x, y: data.y })}
Expand Down
14 changes: 14 additions & 0 deletions packages/smarthr-ui/src/smarthr-ui-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ defaultConfig.twMergeConfig = {
leading: ['none', 'tight', 'normal', 'loose'],
},
],
zIndex: [
{
z: [
'auto',
'0',
'1',
'fixed-menu',
'overlap-base',
'overlap',
'flash-message',
(classPart: string) => /^\[\d+\]$/.test(classPart),
],
},
],
},
}

Expand Down

0 comments on commit cdc7e4e

Please sign in to comment.