Skip to content

feat: intent for input and textarea#60

Merged
chmurson merged 3 commits into
mainfrom
add-intent-to-input-textarea
Nov 6, 2025
Merged

feat: intent for input and textarea#60
chmurson merged 3 commits into
mainfrom
add-intent-to-input-textarea

Conversation

@chmurson
Copy link
Copy Markdown
Collaborator

@chmurson chmurson commented Nov 6, 2025

Screenshot 2025-11-06 at 23 11 11 Screenshot 2025-11-06 at 23 11 05

@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 6, 2025

Deploy Preview for fluffy-ui ready!

Name Link
🔨 Latest commit fc5735f
🔍 Latest deploy log https://app.netlify.com/projects/fluffy-ui/deploys/690d22c1b8700d0008c9977b
😎 Deploy Preview https://deploy-preview-60--fluffy-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 6, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

Introduces intent-based styling for Input and Textarea components by adding a new module defining five intent variants (primary, neutral, destructive, success, warning). Updates both components to accept an optional intent prop with styling applied via class-variance-authority. Adds corresponding story variants showcasing all intent states in normal and disabled configurations.

Changes

Cohort / File(s) Summary
Intent configuration module
lib/ui/Input/input-intent.ts
New file defining InputIntent type as union of five intent values and inputIntentColors CVA function that maps each intent to specific CSS class configurations.
Input component updates
lib/ui/Input/Input.tsx, lib/ui/Input/index.ts
Input component modified to accept optional intent prop (default: "neutral") and apply intent-based styling via inputIntentColors. Index file re-exports intentColors and Intent from the new intent module.
Input stories
lib/ui/Input/Input.stories.tsx
Adds new AllIntents story variant rendering Input components for all five intent states in normal and disabled configurations using ThemeSwitcherDecorator.
Textarea component updates
lib/ui/Textarea/Textarea.tsx
Textarea component updated to support intent prop, importing styling utilities from Input module and applying intent-based classes.
Textarea stories
lib/ui/Textarea/Textarea.stories.tsx
Adds new AllIntents story variant rendering Textarea components for all five intent states in normal and disabled configurations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • lib/ui/Input/input-intent.ts: Verify CVA configuration for each intent variant, ensuring all CSS class values and custom properties are correct and accessible; confirm default variant is set correctly
  • Input and Textarea component integration: Confirm prop destructuring, default values, and className merging logic work correctly with the intent styling
  • Story implementations: Validate that both AllIntents stories render all five intent variants and disabled states as documented

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely describes the main feature: adding intent support to Input and Textarea components.
Description check ✅ Passed The description provides visual context via screenshots showing the new intent variants (primary, neutral, destructive, success, warning) for Input and Textarea components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/ui/Input/Input.tsx (1)

9-22: Remove debug console.log statement.

Line 10 contains a console.log(intent) statement that appears to be debug code and should be removed before merging to production.

Apply this diff:

 const Input = React.forwardRef<HTMLInputElement, InputProps>(({ className, intent = "neutral", ...props }, ref) => {
-  console.log(intent);
   return (
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6321e85 and 612adc3.

📒 Files selected for processing (6)
  • lib/ui/Input/Input.stories.tsx (1 hunks)
  • lib/ui/Input/Input.tsx (1 hunks)
  • lib/ui/Input/index.ts (1 hunks)
  • lib/ui/Input/input-intent.ts (1 hunks)
  • lib/ui/Textarea/Textarea.stories.tsx (1 hunks)
  • lib/ui/Textarea/Textarea.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
lib/ui/Input/Input.tsx (2)
lib/ui/Input/input-intent.ts (2)
  • InputIntent (3-3)
  • inputIntentColors (5-21)
lib/utils.ts (1)
  • cn (4-6)
lib/ui/Input/Input.stories.tsx (1)
lib/ui/Textarea/Textarea.stories.tsx (1)
  • AllIntents (105-172)
lib/ui/Textarea/Textarea.stories.tsx (1)
lib/ui/Input/Input.stories.tsx (1)
  • AllIntents (86-153)
lib/ui/Input/input-intent.ts (1)
lib/ui/Input/index.ts (2)
  • InputIntent (2-2)
  • inputIntentColors (2-2)
lib/ui/Textarea/Textarea.tsx (1)
lib/utils.ts (1)
  • cn (4-6)
🔇 Additional comments (6)
lib/ui/Input/input-intent.ts (1)

1-21: LGTM! Well-structured intent system.

The intent type and CVA configuration are cleanly implemented. The use of CSS custom properties with color-mix() for dynamic theming is a solid approach, and the neutral variant appropriately overrides the base classes for default styling.

lib/ui/Input/index.ts (1)

2-2: LGTM! Clean public API.

The type and utility re-exports with concise aliases provide a clean public interface for consumers.

lib/ui/Textarea/Textarea.stories.tsx (1)

105-172: LGTM! Comprehensive intent demonstration.

The AllIntents story effectively showcases all intent variants in both normal and disabled states, maintaining consistency with the Input component's story structure.

lib/ui/Input/Input.stories.tsx (1)

86-153: LGTM! Thorough intent showcase.

The AllIntents story comprehensively demonstrates all intent variants in both normal and disabled states, providing clear visual examples for each intent type.

lib/ui/Textarea/Textarea.tsx (1)

3-7: LGTM! Proper intent integration.

The intent prop is correctly typed and imported from the shared Input module, promoting consistency across form components.

lib/ui/Input/Input.tsx (1)

3-8: LGTM! Intent prop correctly integrated.

The intent prop is properly typed and integrated into the InputProps interface, maintaining consistency with the Textarea component.

Comment on lines +9 to +23
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, intent = "neutral", ...props }, ref) => {
return (
<textarea
className={cn(
intentColors({ intent }),
"flex min-h-[80px] w-full rounded-md border x-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
ref={ref}
{...props}
/>
);
},
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix typo in className: "x-3" should be "px-3".

Line 15 contains a typo where x-3 should be px-3 for horizontal padding. This would break the padding styling of the textarea.

Apply this diff:

-        "flex min-h-[80px] w-full rounded-md border x-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
+        "flex min-h-[80px] w-full rounded-md border px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
📝 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.

Suggested change
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, intent = "neutral", ...props }, ref) => {
return (
<textarea
className={cn(
intentColors({ intent }),
"flex min-h-[80px] w-full rounded-md border x-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
ref={ref}
{...props}
/>
);
},
);
const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
({ className, intent = "neutral", ...props }, ref) => {
return (
<textarea
className={cn(
intentColors({ intent }),
"flex min-h-[80px] w-full rounded-md border px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
className,
)}
ref={ref}
{...props}
/>
);
},
);
🤖 Prompt for AI Agents
In lib/ui/Textarea/Textarea.tsx around lines 9 to 23, there's a typo in the
textarea className: "x-3" should be "px-3". Update the className string to
replace "x-3" with "px-3" so the horizontal padding applies correctly, leaving
the rest of the classes and props unchanged.

@chmurson chmurson merged commit a3245f5 into main Nov 6, 2025
5 of 6 checks passed
@chmurson chmurson deleted the add-intent-to-input-textarea branch November 6, 2025 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant