Skip to content

Commit

Permalink
update item focusring size
Browse files Browse the repository at this point in the history
  • Loading branch information
lerte committed Nov 22, 2024
1 parent 1a70f0f commit 1e91f7c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
calc(var(--md-focus-ring-duration, 600ms) * 0.75);
animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
box-sizing: border-box;
color: var(--md-focus-ring-color, var(--md-sys-color-secondary, #625b71));
color: var(
--md-focus-ring-color,
rgb(var(--md-sys-color-secondary, 98 91 113))
);
pointer-events: none;
position: absolute;
&:not([inward]) {
Expand Down
9 changes: 6 additions & 3 deletions packages/actify/src/components/ListBox/ListBoxOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ const ListBoxOption = <T extends object>({
{item.rendered}
{isFocusVisible && (
<FocusRing
style={{
color: 'rgb(var(--md-sys-color-primary))'
}}
style={
{
color: 'rgb(var(--md-sys-color-primary))',
'--md-focus-ring-outward-offset': '-3px'
} as React.CSSProperties
}
/>
)}
<Ripple />
Expand Down
9 changes: 6 additions & 3 deletions packages/actify/src/components/Menus/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,12 @@ const MenuItem = (props: MenuItemProps) => {
</Item>
{isFocusVisible && (
<FocusRing
style={{
color: 'rgb(var(--md-sys-color-primary))'
}}
style={
{
color: 'rgb(var(--md-sys-color-primary))',
'--md-focus-ring-outward-offset': '-3px'
} as React.CSSProperties
}
/>
)}
</>
Expand Down
32 changes: 25 additions & 7 deletions packages/actify/src/components/Menus/MenuPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'react-aria-components'

import React from 'react'
import { motion } from 'framer-motion'
import styles from './menu-popover.module.css'

export interface PopoverProps extends Omit<AriaPopoverProps, 'children'> {
Expand All @@ -17,15 +18,32 @@ export interface PopoverProps extends Omit<AriaPopoverProps, 'children'> {

const MenuPopover = ({ children, ...props }: PopoverProps) => {
// make the width of the popover the same as the reference element
props.style = {
...props.style,
'--reference-width': props.referenceWidth + 'px'
} as React.CSSProperties
if (props.referenceWidth) {
props.style = {
...props.style,
'--reference-width': props.referenceWidth + 'px'
} as React.CSSProperties
}

return (
<AriaPopover {...props} className={styles['popover']}>
<OverlayArrow className={styles['underlay']} />
<Dialog className={styles['dialog']}>{children}</Dialog>
<AriaPopover {...props} style={props.style} className={styles['popover']}>
<motion.div
initial={{
height: 0,
overflow: 'hidden'
}}
animate={{
height: 'auto'
}}
transition={{
duration: 0.3
}}
>
<OverlayArrow className={styles['underlay']} />
<Dialog aria-label="dialog" className={styles['dialog']}>
{children}
</Dialog>
</motion.div>
</AriaPopover>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
);
height: inherit;
max-height: inherit;
overflow: auto;
overflow: hidden;
min-width: inherit;
max-width: inherit;
border-radius: var(
Expand Down

0 comments on commit 1e91f7c

Please sign in to comment.