rusackas opened a new pull request, #37770:
URL: https://github.com/apache/superset/pull/37770
## Summary
This PR consolidates the CopyToClipboard component and clipboard utilities
into `@superset-ui/core`, making them reusable for other projects while
maintaining backward compatibility.
### Changes:
**New in @superset-ui/core:**
- **Generic CopyToClipboard component** (`@superset-ui/core/components`)
- Uses `onSuccess`/`onError` callbacks instead of being tied to a specific
toast system
- Includes tooltip, text display, wrapped/unwrapped modes, and async
`getText` support
- **Clipboard utilities** (`@superset-ui/core`)
- `copyTextToClipboard()` - Cross-browser clipboard API with Safari/Chrome
compatibility
- `isSafari()` - Browser detection utility
- **ErrorBoundary component** (`@superset-ui/core`)
- Removes the `react-error-boundary` npm dependency
- API-compatible with react-error-boundary (FallbackComponent,
fallbackRender, onError)
**Updated in Superset:**
- `src/components/CopyToClipboard` - Now a thin wrapper that integrates with
Superset's toast system
- `src/utils/copy.ts` - Re-exports from core for backward compatibility
### Benefits:
1. **Reusability**: Other projects using @superset-ui/core can now use
CopyToClipboard without pulling in Superset's toast infrastructure
2. **Flexibility**: The generic component accepts callbacks, so it can
integrate with any notification system
3. **Backward compatibility**: Existing Superset code continues to work
without changes
4. **Reduced dependencies**: Removes `react-error-boundary` npm package
## Test plan
- [x] Pre-commit hooks pass
- [x] CopyToClipboard tests pass
- [x] SuperChart tests pass
- [ ] CI passes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]