Skip to content

Feature/copyable value component#86

Open
joshsadam wants to merge 12 commits into
mainfrom
feature/copyable-value-component
Open

Feature/copyable value component#86
joshsadam wants to merge 12 commits into
mainfrom
feature/copyable-value-component

Conversation

@joshsadam

@joshsadam joshsadam commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

What does this PR do and why?

  • Adds Pathogen::CopyableValue — a compact inline monospace field with a copy button for IDs and short values to replace the PuidComponent in IRIDA Next with a more generic, cleaner version.
  • Uses a Stimulus controller (Clipboard API + fallback), aria-live feedback, and an animated clipboard-to-checkmark crossfade.

Screenshots or screen recordings

  • Verify in Lookbook: Pathogen → CopyableValue — Basic Usage, Custom Message, Dense List, Accessibility

Light
image

Dark
image

In IRIDA Next (branch published after this is released)

Current Projects Dashboard:
image

Updated Projects Dashboard:
image

Current Project Page
image

Updated Project Page
image

How to set up and validate locally

  1. bin/setup (or ensure deps are installed)
  2. pnpm run build:css
  3. Start Lookbook/demo and open CopyableValue previews — click copy, confirm checkmark animation and revert
  4. bin/test test/components/pathogen/copyable_value_test.rb
  5. pnpm test -- test/javascript/controllers/copyable_value_controller.test.js

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@joshsadam joshsadam self-assigned this Jun 30, 2026
@joshsadam joshsadam added the enhancement New feature or request label Jun 30, 2026
@joshsadam joshsadam requested a review from ericenns June 30, 2026 21:15
@joshsadam joshsadam force-pushed the feature/copyable-value-component branch from c8bf58f to d131fb8 Compare July 2, 2026 16:16
joshsadam added 11 commits July 9, 2026 19:43
Compact monospace chip for IDs and hashes with clipboard copy,
icon feedback, and aria-live announcements for screen readers.
Drive icon feedback from semantic data-state and CSS instead of
classList toggling. Extract clipboard logic, add private fields,
and expose resetDelay as a Stimulus value.
Register pathogen_copyable_value in ViewHelper and add a Lookbook
preview documenting keyboard, aria-live, and manual copy fallback.
Stack clipboard and checkmark icons and crossfade with a subtle
scale pop. Replays on repeat copy; respects reduced motion.
Extract Pathogen::InlineCodeStyles and migrate Typography::Code
to semantic PVC tokens so inline identifiers share one surface
recipe across components.
Match hover, focus, touch target, and motion rules from the
updated design contract. Add error state feedback and share the
inline code surface with Typography::Code.
Replace raw heading and body markup with pathogen_heading,
pathogen_supporting, pathogen_text, and pathogen_code while
keeping semantic-token panels for surfaces.
…tions

Removed unused CSS classes and optimized button styles for better alignment with design specifications. Updated hover states to improve user experience and ensure consistent styling across components.
Renamed size classes from size-4 to size-3.5 in CSS and updated corresponding references in the Ruby component. Adjusted test to verify new class usage, ensuring alignment with design specifications.
Copilot AI review requested due to automatic review settings July 10, 2026 00:45
@joshsadam joshsadam force-pushed the feature/copyable-value-component branch from d131fb8 to cf179ca Compare July 10, 2026 00:45
@joshsadam joshsadam requested a review from ChrisHuynh333 July 10, 2026 00:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Pathogen::CopyableValue ViewComponent for displaying short monospace values with an integrated copy-to-clipboard action, intended as a more generic replacement for IRIDA Next’s PuidComponent. It pairs the component with a Stimulus controller (Clipboard API + fallback), localized accessible labeling/announcements, and CSS-driven success/error feedback.

Changes:

  • Added Pathogen::CopyableValue component + template, sharing a new InlineCodeStyles surface recipe with Pathogen::Typography::Code.
  • Added copyable_value_controller Stimulus controller and supporting CSS for icon crossfade and state styling.
  • Added Lookbook previews, i18n keys, helper registration, importmap pinning, and Ruby/JS test coverage.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/javascript/controllers/copyable_value_controller.test.js Adds Vitest coverage for the new Stimulus controller’s success/error/reset behaviors.
test/components/previews/pathogen/copyable_value_preview/dense_list.html.erb Adds a dense table-style preview demonstrating multiple copyable values.
test/components/previews/pathogen/copyable_value_preview/custom_message.html.erb Adds a preview showing custom screen-reader feedback messaging.
test/components/previews/pathogen/copyable_value_preview/basic_usage.html.erb Adds a basic usage preview for the new component.
test/components/previews/pathogen/copyable_value_preview/accessibility.html.erb Adds an accessibility-focused preview (aria-label and aria-live behavior).
test/components/previews/pathogen/copyable_value_preview.rb Registers the CopyableValue preview group and preview endpoints.
test/components/pathogen/typography/code_test.rb Updates expectations for Code to use the new shared inline surface tokens.
test/components/pathogen/copyable_value_test.rb Adds ViewComponent tests validating markup, aria attributes, controller wiring, and token usage.
lib/pathogen/view_helper.rb Registers pathogen_copyable_value helper for rendering the component.
config/locales/fr.yml Adds French translations for CopyableValue messages and aria-label text.
config/locales/en.yml Adds English translations for CopyableValue messages and aria-label text.
config/importmap.rb Pins the new copyable_value_controller for importmap usage.
app/lib/pathogen/inline_code_styles.rb Introduces shared inline surface class recipe used by Code and CopyableValue.
app/components/pathogen/typography/code.rb Switches Code to reuse the shared inline surface tokens and updates component docs.
app/components/pathogen/copyable_value.rb Adds the new ViewComponent implementation and stimulus data wiring.
app/components/pathogen/copyable_value.html.erb Adds the component template including icons, button, and aria-live region.
app/assets/stylesheets/pathogen.tailwind.css Adds custom CSS for CopyableValue icon crossfade and state styling.
app/assets/stylesheets/pathogen_view_components.css Updates the compiled Tailwind output to include new utilities and CopyableValue CSS.
app/assets/javascripts/pathogen_view_components/copyable_value_controller.js Adds the controller that performs copy + fallback and state/announcement updates.
app/assets/javascripts/pathogen_view_components.js Registers and exports the new controller as part of the bundled controller set.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/components/previews/pathogen/copyable_value_preview/basic_usage.html.erb Outdated
Comment thread app/components/pathogen/copyable_value.rb Outdated
Complete the basic usage preview sentence with a colon and document
the execCommand fallback in the component class comment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants