mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
fix(components): respect transform-origin in popper content (#3919)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import type { ModuleOptions } from '../module'
|
||||
|
||||
export default (options: Required<ModuleOptions>) => ({
|
||||
slots: {
|
||||
content: 'min-w-32 bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) divide-y divide-(--ui-border) overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]',
|
||||
content: 'min-w-32 bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) divide-y divide-(--ui-border) overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-context-menu-content-transform-origin)',
|
||||
group: 'p-1 isolate',
|
||||
label: 'w-full flex items-center font-semibold text-(--ui-text-highlighted)',
|
||||
separator: '-mx-1 my-1 h-px bg-(--ui-border)',
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ModuleOptions } from '../module'
|
||||
|
||||
export default (options: Required<ModuleOptions>) => ({
|
||||
slots: {
|
||||
content: 'min-w-32 bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) divide-y divide-(--ui-border) overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]',
|
||||
content: 'min-w-32 bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) divide-y divide-(--ui-border) overflow-y-auto scroll-py-1 data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-dropdown-menu-content-transform-origin)',
|
||||
arrow: 'fill-(--ui-border)',
|
||||
group: 'p-1 isolate',
|
||||
label: 'w-full flex items-center font-semibold text-(--ui-text-highlighted)',
|
||||
|
||||
@@ -8,7 +8,7 @@ export default (options: Required<ModuleOptions>) => {
|
||||
base: () => ['rounded-md', options.theme.transitions && 'transition-colors'],
|
||||
trailing: 'group absolute inset-y-0 end-0 flex items-center disabled:cursor-not-allowed disabled:opacity-75',
|
||||
arrow: 'fill-(--ui-border)',
|
||||
content: 'max-h-60 w-(--reka-popper-anchor-width) bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] pointer-events-auto',
|
||||
content: 'max-h-60 w-(--reka-combobox-trigger-width) bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-combobox-content-transform-origin) pointer-events-auto',
|
||||
viewport: 'divide-y divide-(--ui-border) scroll-py-1',
|
||||
group: 'p-1 isolate',
|
||||
empty: 'py-2 text-center text-sm text-(--ui-text-muted)',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
slots: {
|
||||
content: 'bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] focus:outline-none pointer-events-auto',
|
||||
content: 'bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-popover-content-transform-origin) focus:outline-none pointer-events-auto',
|
||||
arrow: 'fill-(--ui-border)'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { defu } from 'defu'
|
||||
import { defuFn } from 'defu'
|
||||
import type { ModuleOptions } from '../module'
|
||||
import select from './select'
|
||||
|
||||
export default (options: Required<ModuleOptions>) => {
|
||||
return defu({
|
||||
return defuFn({
|
||||
slots: {
|
||||
input: 'border-b border-(--ui-border)',
|
||||
focusScope: 'flex flex-col min-h-0'
|
||||
focusScope: 'flex flex-col min-h-0',
|
||||
content: (content: string) => [content, 'origin-(--reka-combobox-content-transform-origin) w-(--reka-combobox-trigger-width)']
|
||||
}
|
||||
}, select(options))
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export default (options: Required<ModuleOptions>) => {
|
||||
value: 'truncate pointer-events-none',
|
||||
placeholder: 'truncate text-(--ui-text-dimmed)',
|
||||
arrow: 'fill-(--ui-border)',
|
||||
content: 'max-h-60 w-(--reka-popper-anchor-width) bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] pointer-events-auto',
|
||||
content: 'max-h-60 w-(--reka-select-trigger-width) bg-(--ui-bg) shadow-lg rounded-md ring ring-(--ui-border) overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-select-content-transform-origin) pointer-events-auto',
|
||||
viewport: 'divide-y divide-(--ui-border) scroll-py-1',
|
||||
group: 'p-1 isolate',
|
||||
empty: 'py-2 text-center text-sm text-(--ui-text-muted)',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
slots: {
|
||||
content: 'flex items-center gap-1 bg-(--ui-bg) text-(--ui-text-highlighted) shadow-sm rounded-sm ring ring-(--ui-border) h-6 px-2 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] pointer-events-auto',
|
||||
content: 'flex items-center gap-1 bg-(--ui-bg) text-(--ui-text-highlighted) shadow-sm rounded-sm ring ring-(--ui-border) h-6 px-2 py-1 text-xs select-none data-[state=delayed-open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-tooltip-content-transform-origin) pointer-events-auto',
|
||||
arrow: 'fill-(--ui-border)',
|
||||
text: 'truncate',
|
||||
kbds: `hidden lg:inline-flex items-center shrink-0 gap-0.5 before:content-['·'] before:me-0.5`,
|
||||
|
||||
Reference in New Issue
Block a user