-
Notifications
You must be signed in to change notification settings - Fork 116
feat: Toasts #2111
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
Open
gadenbuie
wants to merge
33
commits into
feat/readme-porting-from-bslib
Choose a base branch
from
feat/toasts
base: feat/readme-porting-from-bslib
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Toasts #2111
+2,653
−1,515
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implements toast(), toast_header(), show_toast(), and hide_toast() functions to create temporary, non-intrusive notification messages. Key features: - Multiple semantic types (success, warning, error, info, etc.) - Flexible positioning (9 positions: top/middle/bottom × left/center/right) - Auto-hide with configurable duration or persistent display - Optional headers with icons and status text - Programmatic show/hide control - Full type safety with proper type hints This implementation: - Adds shiny/ui/_toast.py with core functionality - Exports functions from shiny.ui and shiny.express.ui - Uses existing vendored bslib JavaScript handlers - Follows py-shiny patterns from notification and modal systems 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
API Examples: - Created app-core.py demonstrating all toast features - Created app-express.py with express syntax examples - Examples cover: basic toasts, types, positions, duration control Unit Tests (31 tests, all passing): - Position normalization tests (11 tests) - Toast constructor tests (7 tests) - Toast rendering tests (6 tests) - ToastHeader tests (4 tests) - Integration tests (3 tests) All tests validate: - Position handling (kebab-case, space-separated, lists, case-insensitive) - Type validation and error alias - Autohide and closable combinations - HTML structure and accessibility attributes - Header rendering with icons and status 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Playwright Controller: - Created Toast controller in shiny/playwright/controller/_toast.py - Methods for checking visibility, text content, type, position, autohide - Exports Toast from controller __init__.py End-to-End Tests (8 tests): - test_toast_basic: Basic display and auto-hide - test_toast_types: Success, warning, error type styling - test_toast_header: Structured header with icons - test_toast_positions: Top-left and bottom-right positioning - test_toast_persistent: Non-auto-hiding toasts - test_toast_hide: Programmatic hide_toast() functionality - test_toast_multiple: Multiple simultaneous toasts Test app provides comprehensive coverage of toast features: - Different types and positions - Headers with icons - Persistent toasts - Programmatic control 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
CHANGELOG: - Added entry under New features for toast notification system - Describes key capabilities: types, positions, auto-hide, headers, programmatic control Quartodoc configs: - Added toast functions to _quartodoc-core.yml under "Display messages" - ui.toast, ui.toast_header, ui.show_toast, ui.hide_toast - Added express functions to _quartodoc-express.yml - express.ui.show_toast, express.ui.hide_toast - Added Toast controller to _quartodoc-testing.yml - playwright.controller.Toast 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Fixed test_toast_additional_attributes to use proper keyword arguments instead of unpacking a dict, which was causing type errors. Also applied isort formatting fix to test_toast.py. All checks passing: - Type check: 0 errors - Unit tests: 31 tests passed - Formatting: All files formatted correctly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Updated both app-core.py and app-express.py to provide a comprehensive toast notification demo similar to the R bslib example. Features include: - Interactive toast builder with full customization options - Type and position selection - Duration control with slider - Header options with Font Awesome icons (via faicons) - Advanced features (persistent, long duration, no close button) - Interactive toasts with action buttons - Multiple toast demonstrations - Position testing across all 9 positions - Dynamic content toast with matplotlib plot (core only) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ports rstudio/bslib#1246 to Shiny for Python