| 471 | }; |
| 472 | |
| 473 | const SideNavItemContentInner = props => { |
| 474 | let { |
| 475 | isExpanded, |
| 476 | hasChildItems, |
| 477 | isDisabled, |
| 478 | isSelected, |
| 479 | setLinkPressed, |
| 480 | linkProps, |
| 481 | scale, |
| 482 | id, |
| 483 | state, |
| 484 | selectedRoute, |
| 485 | isHovered, |
| 486 | isFocusVisible, |
| 487 | isFocusVisibleWithin, |
| 488 | children |
| 489 | } = props; |
| 490 | |
| 491 | useRouteFocusSync({state}); |
| 492 | |
| 493 | // Whether the link within this row is the focused element (any modality). Combined with the |
| 494 | // keyboard-only isFocusVisibleWithin below, this lets the row focus ring follow the link |
| 495 | // specifically and not other focusable children (e.g. an ActionMenu trigger). |
| 496 | let [isLinkFocused, setLinkFocused] = useState(false); |
| 497 | |
| 498 | let hasLink = linkProps.href != null && linkProps.href.length > 0; |
| 499 | |
| 500 | return ( |
| 501 | <> |
| 502 | <div |
| 503 | className={treeRowFocusRing({ |
| 504 | isFocusVisible: isFocusVisible || (isFocusVisibleWithin && isLinkFocused), |
| 505 | isSelected |
| 506 | })} |
| 507 | /> |
| 508 | <div |
| 509 | className={treeCellGrid({ |
| 510 | isDisabled, |
| 511 | isSelected: linkProps.href === selectedRoute, |
| 512 | isDescendantSelected: |
| 513 | !isExpanded && hasChildItems && hasSelectedDescendant(id, state, selectedRoute) |
| 514 | })}> |
| 515 | <div |
| 516 | className={indicator({ |
| 517 | isDisabled, |
| 518 | isSelected: linkProps.href === selectedRoute, |
| 519 | isHovered: isHovered && hasLink |
| 520 | })} |
| 521 | /> |
| 522 | <div |
| 523 | className={style({ |
| 524 | gridArea: 'level-padding', |
| 525 | width: 'calc(calc(var(--tree-item-level, 0) - 1) * var(--indent))' |
| 526 | })} |
| 527 | /> |
| 528 | <Provider |
| 529 | values={[ |
| 530 | [TextContext, {styles: treeContent}], |
nothing calls this directly
no test coverage detected