Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Improve multiple components #142

Draft
wants to merge 3 commits into
base: feature/accessibility-hook
Choose a base branch
from

Conversation

selenil
Copy link
Contributor

@selenil selenil commented Jan 24, 2025

Summary by Sourcery

New Features:

  • Add support for ZagJS in the HoverCard and Tooltip components for enhanced functionality and accessibility.

Copy link

sourcery-ai bot commented Jan 24, 2025

Reviewer's Guide by Sourcery

This pull request improves the HoverCard and Tooltip components by adding support for the Zag.js library, which provides better control over the positioning and behavior of these components. The changes include adding new attributes for configuring the components, such as side, options, and on_open, and updating the component templates to use the Zag.js data attributes.

Sequence diagram for HoverCard interaction

sequenceDiagram
    actor User
    participant HC as HoverCard
    participant Zag as Zag.js

    User->>HC: Hover over trigger
    HC->>Zag: Trigger hover event
    Zag->>HC: Calculate position
    HC->>HC: Show content with animation
    Note over HC: Position based on 'side' parameter

    User->>HC: Move mouse away
    HC->>HC: Hide content with animation
    HC->>Zag: Emit on_open_change event
Loading

Class diagram for updated HoverCard and Tooltip components

classDiagram
    class HoverCard {
        +id: string
        +open: boolean
        +side: string
        +options: map
        +on_open: list
        +class: string
        +hover_card()
        +hover_card_trigger()
        +hover_card_content()
    }

    class Tooltip {
        +id: string
        +side: string
        +options: map
        +on_open: list
        +class: string
        +tooltip()
        +tooltip_trigger()
        +tooltip_content()
    }

    note for HoverCard "Added Zag.js integration
New positioning options
Improved configuration"
    note for Tooltip "Added Zag.js integration
Enhanced positioning control"
Loading

File-Level Changes

Change Details Files
Added support for Zag.js to the HoverCard component.
  • Added id, open, side, options, and on_open attributes to the hover_card component.
  • Updated the hover_card component template to include phx-hook, data-component, data-parts, data-options, and data-listeners attributes.
  • Updated the hover_card_trigger component template to include data-part attribute.
  • Updated the hover_card_content component template to include data-part attribute and to use a positioner div.
lib/salad_ui/hover_card.ex
Added support for Zag.js to the Tooltip component.
  • Added id, side, options, and on_open attributes to the tooltip component.
  • Updated the tooltip component template to include phx-hook, data-component, data-parts, data-options, and data-listeners attributes.
  • Updated the tooltip_trigger component template to include data-part attribute.
  • Updated the tooltip_content component template to include data-part attribute and to use a positioner div.
lib/salad_ui/tooltip.ex

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

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