Components: modernize CopyToClipboard and retire forms local variant#48193
Components: modernize CopyToClipboard and retire forms local variant#48193
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
Proposed changes
Modernizes the
CopyToClipboardcomponent in@automattic/jetpack-componentsand retires the localCopyClipboardButtonthat the forms package was maintaining in parallel.@automattic/jetpack-components'sCopyToClipboardon top of@wordpress/componentsButton+Tooltipand@wordpress/icons(copySmall/check). The jetpack-componentsButtonwrapper and the package-localClipboardIcon/CheckmarkIconare no longer used by this component — same icons and same core button as the forms version.copyMessage/copiedMessageprops so callers can customize the labels. Icon-only mode now shows a tooltip that flips to the copied message on success, matching the UX the forms package was using.text/icon-textmodes; the copied state always transitions to thecopiedMessage.packages/forms/src/dashboard/components/copy-clipboard-button/and migrates the four forms call sites (embed modal, response inspector's email field, response meta) to the shared component.Consumer visual delta (accepted)
CopyToClipboardpreviously spread props through the jetpack-componentsButtonwrapper, which adds aweightprop. The WP coreButtonhas noweight, so two call sites will render with the default WP Button weight (bold) instead ofregular:projects/plugins/boost/app/assets/src/js/pages/cache-debug-log/cache-debug-log.tsxprojects/plugins/jetpack/extensions/shared/clipboard-input.jsThe regression is accepted per the spec. No code changes at those call sites — reviewers who want the old look back can restyle via class names in a follow-up.
packages/publicize/_inc/components/share-buttons/share-buttons.tsxdoesn't useweight; it's unaffected.Out of scope
ClipboardIconandCheckmarkIconare no longer used byCopyToClipboardbut remain exported. A follow-up PR will mark them deprecated.useCopyToClipboardhook consumers (ai-chat copy button, videopress clipboard-button-input, celebrate-launch modal, site-preview-link) are untouched — out of scope for this PR.Related product discussion/links
Does this pull request change what data or activity we track or use?
No.
Testing instructions
Please verify each surface visually — no interactive visual verification was done on this PR.
extensions/shared/clipboard-input.js→ verify the "Copy" icon-text button still copies and still flips to the copied state. Text weight will render bold now (was previously regular).icon,text, andicon-textstyles.What was verified on this PR
tsgo --noEmit) passes forprojects/js-packages/componentsandprojects/packages/forms.52 passed, 650 passedforpackages/formsand27 passed, 109 passedforjs-packages/componentsat the time the PR was prepared.js-packages/components,packages/forms, andplugins/jetpack.plugins/jetpackbundle was rsynced to a Jurassic Ninja site. WP admin bootstrap loaded without errors, but the forms admin page requires an authenticated Jetpack connection that wasn't completed, so no interactive click-through of the copy-to-clipboard UIs was performed.