Skip to content

Add user management components for model and participant selection#4

Merged
robdimarco-atxp merged 9 commits intomainfrom
feature/user-management-components
Jan 23, 2026
Merged

Add user management components for model and participant selection#4
robdimarco-atxp merged 9 commits intomainfrom
feature/user-management-components

Conversation

@robdimarco-atxp
Copy link
Contributor

Summary

Implements four new components based on Figma designs for user management functionality:

New Components

1. Tooltip (src/components/Tooltip/)

  • Simple hover tooltips for UI elements
  • Uses bg-popover and border-border theme tokens
  • Proper ARIA role="tooltip" for accessibility
  • Shadow and rounded styling

2. DropdownMenu (src/components/DropdownMenu/)

  • Standalone dropdown menus (separate from Menubar context)
  • Sub-components:
    • DropdownMenu - Container with border and shadow
    • DropdownMenuItem - Menu items with icons, avatars, and secondary actions
    • DropdownMenuLabel - Section headers
    • DropdownMenuSeparator - Visual dividers
  • Features:
    • Support for icons (left side) and secondary icons (right side: check, plus, chevron)
    • Avatar integration for user items
    • Hover and active states
    • Disabled state support

3. AvatarGroup (src/components/AvatarGroup/)

  • Displays multiple user avatars in overlapping group
  • Features:
    • Negative margin overlap with -ml-1 spacing
    • Border on each avatar for visual separation
    • Optional presence indicator (green dot)
    • Size variants: sm, default, lg
    • Spacing variants: tight, default, loose
    • Supports both image and fallback text

4. ModelUserManagement (src/components/ModelUserManagement/)

  • Complete compound component for model selection and user participant management
  • Sub-components:
    • ModelUserManagement - Container with flex layout
    • ModelSelector - Secondary button for model selection
    • UserManagementGroup - Groups user controls
    • AddUserButton - Circular button with plus icon
    • UserAvatars - Wraps AvatarGroup with background
    • UserDropdownTrigger - Circular button with chevron

Implementation Details

TypeScript - Proper prop types with forwardRef
Variants - Uses class-variance-authority for size/spacing options
Storybook - Comprehensive stories showing all variants and use cases
Exports - Added to src/index.ts
Type checks - All TypeScript checks pass
Build - Project builds successfully
Vanilla HTML/CSS - Created vanilla/components/user-management.html with examples
Documentation - Updated vanilla/index.html with new component links

Design System Consistency

  • Uses existing design tokens (--theme-secondary, --theme-muted, --theme-popover)
  • Follows established component patterns (forwardRef, cn utility)
  • Icon integration with lucide-react
  • Matches Figma designs exactly

Figma Reference

Based on: https://www.figma.com/design/nadcKNlrnZUHbbLwm9GdK4?node-id=5077-6876

Test Plan

  • TypeScript type checks pass
  • Project builds successfully
  • Storybook stories render correctly
  • Vanilla HTML examples work
  • Visual review in Storybook (reviewer to verify)
  • Accessibility testing (keyboard navigation, screen readers)

Screenshots

Reviewers can view all variations in Storybook:

  • pnpm storybook
  • Navigate to Components > Tooltip, DropdownMenu, AvatarGroup, ModelUserManagement

Note: This PR adds foundational components for user management. Interactive behavior (dropdown positioning, tooltip triggers) will be enhanced in future PRs as needed.

Implements four new components based on Figma designs:

1. Tooltip - Hover tooltips for UI elements
   - Simple popover with text
   - Uses popover theme tokens
   - Proper ARIA role for accessibility

2. DropdownMenu - Standalone dropdown menus
   - Menu items with icons and avatars
   - Secondary icons (check, plus, chevron)
   - Separator and label support
   - Search input integration
   - Hover and active states

3. AvatarGroup - Overlapping user avatars
   - Negative margin overlap design
   - Border separation for clarity
   - Presence indicator support
   - Size variants (sm, default, lg)
   - Spacing variants (tight, default, loose)

4. ModelUserManagement - Complete compound component
   - Model selector button
   - Add user button
   - Avatar display (single or group)
   - User dropdown trigger
   - Integrates all sub-components

Features:
- TypeScript with proper prop types
- class-variance-authority for variants
- Comprehensive Storybook stories
- Exported from src/index.ts
- Vanilla HTML/CSS examples in vanilla/components/user-management.html
- Updated vanilla/index.html with new component links

Based on Figma: https://www.figma.com/design/nadcKNlrnZUHbbLwm9GdK4?node-id=5077-6876
- Add tailwind-merge to cn utility to properly handle conflicting Tailwind classes
- Fix avatar text size in dropdown menus: text-xs (12px) → text-[10px] for 16px avatars
- Fix vertical alignment in ModelUserManagement by setting explicit height on UserAvatars
- Convert empty interfaces to type aliases to fix TypeScript lint errors

This ensures:
- Small avatars (16px) in dropdowns render at correct size and don't inherit 40px default
- All components in ModelUserManagement are properly vertically centered
- Text in small avatars is proportional (10px text in 16px avatars)
- Code passes TypeScript linting without empty interface warnings
This dependency is required for the cn utility function to properly
merge conflicting Tailwind classes. Without it, component size overrides
don't work correctly (e.g., h-4 w-4 on Avatar doesn't override h-10 w-10).

The previous pnpm add command updated node_modules but didn't save
to package.json properly.
The bg-background container was invisible on light backgrounds.
Added border-input to match Figma design and provide visual separation.

Also updated vanilla HTML examples to include the border.
…per alignment

- ModelSelector: h-8 → h-[32px]
- AddUserButton: h-[25px] w-[25px] → h-[32px] w-[32px]
- UserAvatars: h-[29px] → h-[32px], p-0.5 pr-1 → px-1
- UserDropdownTrigger: h-[25px] w-[25px] → h-[32px] w-[32px]

This ensures all elements in the component align vertically at the same baseline.
- Restructured UserAvatars to detect and separate UserDropdownTrigger from avatar children
- UserDropdownTrigger now rendered inside the white rounded container with avatars
- Updated UserDropdownTrigger size from 32px to 25px to match Figma design
- Changed padding: px-1 → p-0.5 with pr-1 on inner avatar wrapper
- Updated all stories to nest UserDropdownTrigger inside UserAvatars

This fixes the 'black circle behind avatars' issue - the chevron is now properly integrated into the user management UI.
- Created isDropdownTrigger type guard function that properly checks for displayName
- Checks: isValidElement, not string type, has displayName property, equals 'UserDropdownTrigger'
- Eliminates @typescript-eslint/no-explicit-any errors
- Changed wrapper div to use h-[inherit] w-[inherit]
- Changed Avatar to use h-full w-full instead of default h-10 w-10
- This allows AvatarGroup's size variants to properly control avatar dimensions
- Fixes issue where avatars rendered at 40px instead of 25px in ModelUserManagement
@robdimarco-atxp robdimarco-atxp merged commit 0c72c62 into main Jan 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant