fix: clear button rendering + input trailing-icon transition#811
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR introduces a DataTable Search demo feature by first improving the underlying Search component's clear button behavior. The Search component now always renders the clear button when Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/www/src/content/docs/components/datatable/demo.ts`:
- Line 68: The preview snippet omits the showClearButton prop causing
inconsistency with the live demo; update the demo preview so DataTable.Search
includes showClearButton (matching DataTableSearchDemo) by adding the
showClearButton prop to the DataTable.Search element and ensure its placeholder
remains "Search payments…", so the preview and the component DataTableSearchDemo
render identically.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ed52be2b-5f83-48f3-bbe3-44fa383629cc
📒 Files selected for processing (11)
apps/www/src/components/datatable-demo.tsxapps/www/src/components/demo/demo.tsxapps/www/src/content/docs/components/datatable/demo.tsapps/www/src/content/docs/components/datatable/index.mdxpackages/raystack/components/data-table/__tests__/data-table.test.tsxpackages/raystack/components/data-table/components/search.tsxpackages/raystack/components/data-view-beta/components/search.tsxpackages/raystack/components/input/input.module.csspackages/raystack/components/search/__tests__/search.test.tsxpackages/raystack/components/search/search.module.csspackages/raystack/components/search/search.tsx
💤 Files with no reviewable changes (1)
- packages/raystack/components/input/input.module.css
| mode="client" | ||
| columns={columns} | ||
| defaultSort={{ name: "email", order: "asc" }}> | ||
| <DataTable.Search placeholder="Search payments…" /> |
There was a problem hiding this comment.
Keep preview snippet consistent with the live demo behavior.
Line 68 omits showClearButton, while DataTableSearchDemo renders it. This makes the docs code preview inconsistent with what users see in the demo.
Suggested doc snippet fix
- <DataTable.Search placeholder="Search payments…" />
+ <DataTable.Search placeholder="Search payments…" showClearButton />📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <DataTable.Search placeholder="Search payments…" /> | |
| <DataTable.Search placeholder="Search payments…" showClearButton /> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/www/src/content/docs/components/datatable/demo.ts` at line 68, The
preview snippet omits the showClearButton prop causing inconsistency with the
live demo; update the demo preview so DataTable.Search includes showClearButton
(matching DataTableSearchDemo) by adding the showClearButton prop to the
DataTable.Search element and ensure its placeholder remains "Search payments…",
so the preview and the component DataTableSearchDemo render identically.
Summary
showClearButtonis set; CSS (:has(input:placeholder-shown)) hides it while the field is empty, avoiding mount/unmount flicker as the user types.valueto''inDataTable.SearchandDataViewSearchso the underlyingSearchstays controlled even before any input.backgroundon.input-field:focus; the wrapper already animates the focused background via:focus-within, so the trailing-icon area no longer lags behind the input during the hover → focus transition.DataTable.Searchlive example to the docs (demo component, preview export, MDX section).