diff --git a/packages/@react-spectrum/ai/src/PromptField.tsx b/packages/@react-spectrum/ai/src/PromptField.tsx index 9233598b35a..5f63de843c8 100644 --- a/packages/@react-spectrum/ai/src/PromptField.tsx +++ b/packages/@react-spectrum/ai/src/PromptField.tsx @@ -101,7 +101,6 @@ export interface PromptFieldProps { styles?: StyleString; variant?: 'balanced' | 'prominent' | 'subtle'; brandColor?: string; - hideDisclaimer?: boolean; } interface PromptFieldState { @@ -193,7 +192,6 @@ export const PromptField = forwardRef(function PromptField( styles, onAddAttachments, onRemoveAttachments, - hideDisclaimer, variant = 'balanced', brandColor } = props; @@ -286,17 +284,15 @@ export const PromptField = forwardRef(function PromptField( inputRef={inputRef}> {children} - {!hideDisclaimer && ( -

- {stringFormatter.format('promptfield.aiDisclaimer')}{' '} - - {stringFormatter.format('promptfield.aiUserGuidlines')} - -

- )} +

+ {stringFormatter.format('promptfield.aiDisclaimer')}{' '} + + {stringFormatter.format('promptfield.aiUserGuidlines')} + +

); diff --git a/packages/@react-spectrum/s2/src/SideNav.tsx b/packages/@react-spectrum/s2/src/SideNav.tsx index 499af41e28d..5188835159d 100644 --- a/packages/@react-spectrum/s2/src/SideNav.tsx +++ b/packages/@react-spectrum/s2/src/SideNav.tsx @@ -322,10 +322,19 @@ const SideNavItemLinkContext = createContext<{ onPressChange?: (isPressed: boolean) => void; }>({}); +const SideNavInternalItemContext = createContext<{setLinkPressed?: (isPressed: boolean) => void}>( + {} +); + export const SideNavItem = (props: SideNavItemProps): ReactNode => { let {href, hrefLang, target, rel, download, ping, referrerPolicy, routerOptions, ...rest} = props; let hasLink = href != null && href.length > 0; + let [isLinkPressed, setLinkPressed] = useState(false); + let rowRef = useRef(null); + // oxlint-disable-next-line react-compiler + let scaling = pressScale(rowRef); + return ( { referrerPolicy, routerOptions }}> - treeRow(renderProps)} - /> + + scaling({isPressed: isLinkPressed || isPressed})} + href={href} + focusMode={hasLink ? 'child' : undefined} + allowsArrowNavigation + className={renderProps => treeRow(renderProps)} + /> + ); }; @@ -415,6 +428,7 @@ export const SideNavItemContent = (props: SideNavItemContentProps): ReactNode => let {children} = props; let scale = useScale(); let linkProps = useContext(SideNavItemLinkContext); + let {setLinkPressed} = useContext(SideNavInternalItemContext); let {selectedRoute} = useContext(InternalSideNavContext); return ( @@ -437,6 +451,7 @@ export const SideNavItemContent = (props: SideNavItemContentProps): ReactNode => hasChildItems={hasChildItems} isDisabled={isDisabled} isSelected={isSelected} + setLinkPressed={setLinkPressed} linkProps={linkProps} scale={scale} id={id} @@ -460,13 +475,13 @@ const SideNavItemContentInner = props => { hasChildItems, isDisabled, isSelected, + setLinkPressed, linkProps, scale, id, state, selectedRoute, isHovered, - isPressed, isFocusVisible, isFocusVisibleWithin, children @@ -478,25 +493,24 @@ const SideNavItemContentInner = props => { // keyboard-only isFocusVisibleWithin below, this lets the row focus ring follow the link // specifically and not other focusable children (e.g. an ActionMenu trigger). let [isLinkFocused, setLinkFocused] = useState(false); - let [isLinkPressed, setLinkPressed] = useState(false); - let cellRef = useRef(null); let hasLink = linkProps.href != null && linkProps.href.length > 0; - // oxlint-disable-next-line react-compiler - let itemScaling = pressScale(cellRef)({isPressed: isLinkPressed || isPressed}); - return ( <>
+
+ })}>
{ isHovered: isHovered && hasLink })} /> -